Skip to content

Commit 6ddc053

Browse files
committed
Add unit test for preprocessor directive folding
1 parent f6abf49 commit 6ddc053

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

clang-tools-extra/clangd/unittests/SemanticSelectionTests.cpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,26 @@ TEST(FoldingRanges, PseudoParserWithoutLineFoldings) {
370370
//[[ foo
371371
/* bar */]]
372372
)cpp",
373+
R"cpp(
374+
//Ignore non-conditional directives
375+
#define A 1
376+
377+
void func() {[[
378+
int Variable = 100;
379+
380+
#ifdef FOO[[
381+
Variable = 1;
382+
]]#else[[
383+
Variable = 2;
384+
//handle nested directives
385+
#if 1[[
386+
Variable = 3;
387+
]]#endif
388+
]]#endif
389+
390+
391+
]]}
392+
)cpp",
373393
};
374394
for (const char *Test : Tests) {
375395
auto T = Annotations(Test);

0 commit comments

Comments
 (0)