diff options
Diffstat (limited to 'clang/unittests/Format')
-rw-r--r-- | clang/unittests/Format/FormatTestSelective.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/clang/unittests/Format/FormatTestSelective.cpp b/clang/unittests/Format/FormatTestSelective.cpp index a28dfd32e1c..9c4d1c3d2b0 100644 --- a/clang/unittests/Format/FormatTestSelective.cpp +++ b/clang/unittests/Format/FormatTestSelective.cpp @@ -446,6 +446,27 @@ TEST_F(FormatTestSelective, UnderstandsTabs) { 21, 0)); } +TEST_F(FormatTestSelective, StopFormattingWhenLeavingScope) { + EXPECT_EQ( + "void f() {\n" + " if (a) {\n" + " g();\n" + " h();\n" + "}\n" + "\n" + "void g() {\n" + "}", + format("void f() {\n" + " if (a) {\n" // Assume this was added without the closing brace. + " g();\n" + " h();\n" + "}\n" + "\n" + "void g() {\n" // Make sure not to format this. + "}", + 15, 0)); +} + } // end namespace } // end namespace format } // end namespace clang |