daiyousei-qz updated this revision to Diff 514087. daiyousei-qz added a comment.
Add a test in SemanticHighlightingTests.cpp Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D148489/new/ https://reviews.llvm.org/D148489 Files: clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp Index: clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp =================================================================== --- clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp +++ clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp @@ -7,6 +7,7 @@ //===----------------------------------------------------------------------===// #include "Annotations.h" +#include "Config.h" #include "Protocol.h" #include "SemanticHighlighting.h" #include "SourceCode.h" @@ -1260,6 +1261,17 @@ EXPECT_EQ(Toks[3].deltaStart, 2u); EXPECT_EQ(Toks[3].length, 3u); } + +TEST(SemanticHighlighting, WithHighlightingFilter) { + llvm::StringRef AnnotatedCode = R"cpp( +int *$Variable[[x]] = new int; +)cpp"; + Config Cfg; + Cfg.SemanticTokens.DisabledKinds = { "Operator" }; + Cfg.SemanticTokens.DisabledModifiers = { "Declaration", "Definition" }; + WithContextValue WithCfg(Config::Key, std::move(Cfg)); + checkHighlightings(AnnotatedCode, {}, ~ScopeModifierMask); +} } // namespace } // namespace clangd } // namespace clang
Index: clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp =================================================================== --- clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp +++ clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp @@ -7,6 +7,7 @@ //===----------------------------------------------------------------------===// #include "Annotations.h" +#include "Config.h" #include "Protocol.h" #include "SemanticHighlighting.h" #include "SourceCode.h" @@ -1260,6 +1261,17 @@ EXPECT_EQ(Toks[3].deltaStart, 2u); EXPECT_EQ(Toks[3].length, 3u); } + +TEST(SemanticHighlighting, WithHighlightingFilter) { + llvm::StringRef AnnotatedCode = R"cpp( +int *$Variable[[x]] = new int; +)cpp"; + Config Cfg; + Cfg.SemanticTokens.DisabledKinds = { "Operator" }; + Cfg.SemanticTokens.DisabledModifiers = { "Declaration", "Definition" }; + WithContextValue WithCfg(Config::Key, std::move(Cfg)); + checkHighlightings(AnnotatedCode, {}, ~ScopeModifierMask); +} } // namespace } // namespace clangd } // namespace clang
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits