diff options
Diffstat (limited to 'clang/unittests/Format/FormatTestComments.cpp')
-rw-r--r-- | clang/unittests/Format/FormatTestComments.cpp | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/clang/unittests/Format/FormatTestComments.cpp b/clang/unittests/Format/FormatTestComments.cpp index cb1cefa47cf..df24abe2612 100644 --- a/clang/unittests/Format/FormatTestComments.cpp +++ b/clang/unittests/Format/FormatTestComments.cpp @@ -1683,14 +1683,6 @@ TEST_F(FormatTestComments, IgnoresIf0Contents) { "void f( ) { }\n" "#endif\n" "void g( ) { }\n")); - EXPECT_EQ("#ifdef SWIG\n" - "}{)(&*(^%%#%@! fsadj f;ldjs ,:;| <<<>>>][)(][\n" - "#endif\n" - "void f() {}", - format("#ifdef SWIG\n" - "}{)(&*(^%%#%@! fsadj f;ldjs ,:;| <<<>>>][)(][\n" - "#endif\n" - "void f( ) { }")); EXPECT_EQ("enum E {\n" " One,\n" " Two,\n" @@ -1809,6 +1801,22 @@ TEST_F(FormatTestComments, IgnoresIf0Contents) { "#endif\n" "Five\n" "};")); + + // Ignore stuff in SWIG-blocks. + EXPECT_EQ("#ifdef SWIG\n" + "}{)(&*(^%%#%@! fsadj f;ldjs ,:;| <<<>>>][)(][\n" + "#endif\n" + "void f() {}", + format("#ifdef SWIG\n" + "}{)(&*(^%%#%@! fsadj f;ldjs ,:;| <<<>>>][)(][\n" + "#endif\n" + "void f( ) { }")); + EXPECT_EQ("#ifndef SWIG\n" + "void f() {}\n" + "#endif", + format("#ifndef SWIG\n" + "void f( ) { }\n" + "#endif")); } TEST_F(FormatTestComments, DontCrashOnBlockComments) { |