summaryrefslogtreecommitdiff
path: root/clang-tools-extra/clangd/unittests/SemanticSelectionTests.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang-tools-extra/clangd/unittests/SemanticSelectionTests.cpp')
-rw-r--r--clang-tools-extra/clangd/unittests/SemanticSelectionTests.cpp39
1 files changed, 39 insertions, 0 deletions
diff --git a/clang-tools-extra/clangd/unittests/SemanticSelectionTests.cpp b/clang-tools-extra/clangd/unittests/SemanticSelectionTests.cpp
index 7ede19c321bc..4efae25dcd07 100644
--- a/clang-tools-extra/clangd/unittests/SemanticSelectionTests.cpp
+++ b/clang-tools-extra/clangd/unittests/SemanticSelectionTests.cpp
@@ -371,6 +371,45 @@ TEST(FoldingRanges, PseudoParserWithoutLineFoldings) {
//[[ foo
/* bar */]]
)cpp",
+ R"cpp(
+ //Ignore non-conditional directives
+ #define A 1
+
+ void func() {[[
+ int Variable = 100;
+
+ #ifdef FOO[[
+ Variable = 1;
+ #if 1[[
+ Variable = 4;
+ ]]#endif
+ ]]#else[[
+ Variable = 2;
+ //handle nested directives
+ #if 1[[
+ Variable = 3;
+ ]]#endif
+ ]]#endif
+
+
+ ]]}
+ )cpp",
+ R"cpp(
+ int Variable = 0;
+ #if defined(WALDO)
+ Variable = 1;
+ #
+ )cpp",
+ R"cpp(
+ int Variable = 0;
+ #if defined(WALDO)[[
+ Variable = 1;
+ ]]#elif 1[[
+ Variable = 2;
+ ]]#else
+ Variable = 3;
+ #
+ )cpp",
};
for (const char *Test : Tests) {
auto T = Annotations(Test);