[PATCH] D64475: [clangd] Duplicate lines of semantic highlightings sent removed.

Ilya Biryukov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 18 08:04:25 PDT 2019


ilya-biryukov added inline comments.


================
Comment at: clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp:307
 
+TEST(SemanticHighlighting, HighlightingDiffer) {
+  struct {
----------------
Can we test this in a more direct manner by specifying:
1. annotated input for old highlightings,
2. annotated input for new highlightings,
3. the expected diff?

The resulting tests don't have to be real C++ then, allowing to express what we're testing in a more direct manner.
```
{/*Old*/ "$Variable[[a]]", /*New*/ "$Class[[a]]", /*Diff*/ "{{/*line */0, "$Class[[a]]"}}
```

It also seems that the contents of the lines could even be checked automatically (they should be equal to the corresponding line from `/*New*/`, right?), that leaves us with even simpler inputs:
```
{/*Old*/ "$Variable[[a]]", /*New*/ "$Class[[a]]", /*DiffLines*/ "{0}}
```


================
Comment at: clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp:391
+  for (const auto &Test : TestCases) {
+    checkDiffedHighlights(Test.OldCode, Test.NewCode);
+  }
----------------
NIT: remove braces


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D64475/new/

https://reviews.llvm.org/D64475





More information about the cfe-commits mailing list