[PATCH] D41432: [clangd] Switch xrefs and documenthighlight to annotated-code unit tests. NFC
Sam McCall via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Dec 20 02:11:59 PST 2017
sammccall created this revision.
sammccall added a reviewer: ioeric.
Herald added subscribers: cfe-commits, ilya-biryukov, mgorny, klimek.
The goal here is again to make it easier to read and write the tests.
I've extracted `parseTextMarker` from CodeCompleteTests into an `Annotations`
class, adding features to it:
- as well as points `^s` 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
(I'll probably promote the extra `PrintTo`s from some of the core Protocol types
into `operator<<` in `Protocol.h` itself in a separate, prior patch...)
Repository:
rCTE Clang Tools Extra
https://reviews.llvm.org/D41432
Files:
test/clangd/definitions.test
test/clangd/documenthighlight.test
test/clangd/xrefs.test
unittests/clangd/Annotations.cpp
unittests/clangd/Annotations.h
unittests/clangd/CMakeLists.txt
unittests/clangd/CodeCompleteTests.cpp
unittests/clangd/Matchers.h
unittests/clangd/XRefsTests.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D41432.127672.patch
Type: text/x-patch
Size: 39984 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20171220/26964871/attachment-0001.bin>
More information about the cfe-commits
mailing list