The goal here is again to make it easier to read and write the tests.
The existing lit tests are replaced with a (relatively) tiny smoke test (xrefs.test).
I've extracted parseTextMarker from CodeCompleteTests into an Annotations
class, adding features to it:
- as well as points ^ it allows ranges [[...]]
- multiple points and ranges are supported
- points and ranges may be named: $name^ and $name[[...]]
These features are used for the xrefs tests. This also paves the way for
replacing the lit diagnostics.test with more readable unit tests, using named
ranges.
Alternative considered: TestSelectionRange in clang-refactor/TestSupport
Main problems were:
- delimiting the end of ranges is awkward, requiring counting
- comment syntax is long and at least as cryptic for most cases
- no separate syntax for point vs range, which keeps xrefs tests concise
- Still need to convert to Position everywhere
- Still need helpers for common case of expecting exactly one point/range
Does this support overlapping annotations like (named) points in (named) ranges?