diff options
Diffstat (limited to 'clang/unittests/Format/FormatTest.cpp')
| -rw-r--r-- | clang/unittests/Format/FormatTest.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp index 5ebf0d7068dd..53aa93a7a4fb 100644 --- a/clang/unittests/Format/FormatTest.cpp +++ b/clang/unittests/Format/FormatTest.cpp @@ -17282,6 +17282,12 @@ TEST_F(FormatTest, ConfigurableSpacesInParens) { Spaces.SpacesInParens = FormatStyle::SIPO_Custom; Spaces.SpacesInParensOptions = {}; Spaces.SpacesInParensOptions.Other = true; + + EXPECT_FALSE(Spaces.SpacesInParensOptions.InConditionalStatements); + verifyFormat("if (a)\n" + " return;", + Spaces); + Spaces.SpacesInParensOptions.InConditionalStatements = true; verifyFormat("do_something( ::globalVar );", Spaces); verifyFormat("call( x, y, z );", Spaces); @@ -27577,6 +27583,12 @@ TEST_F(FormatTest, InsertNewlineAtEOF) { verifyNoChange("int i;\n", Style); verifyFormat("int i;\n", "int i;", Style); + + constexpr StringRef Code{"namespace {\n" + "int i;\n" + "} // namespace"}; + verifyFormat(Code.str() + '\n', Code, Style, + {tooling::Range(19, 13)}); // line 3 } TEST_F(FormatTest, KeepEmptyLinesAtEOF) { |
