diff options
Diffstat (limited to 'unittests/Format')
-rw-r--r-- | unittests/Format/FormatTest.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/unittests/Format/FormatTest.cpp b/unittests/Format/FormatTest.cpp index 51a0bd6488..860661b432 100644 --- a/unittests/Format/FormatTest.cpp +++ b/unittests/Format/FormatTest.cpp @@ -615,6 +615,30 @@ TEST_F(FormatTest, LayoutStatementsAroundPreprocessorDirectives) { " trailing);", getLLVMStyleWithColumns(69)); } +TEST_F(FormatTest, LayoutBlockInsideParens) { + EXPECT_EQ("functionCall({\n" + " int i;\n" + "});", format(" functionCall ( {int i;} );")); +} + +TEST_F(FormatTest, LayoutBlockInsideStatement) { + EXPECT_EQ("SOME_MACRO {\n" + " int i;\n" + "}\n" + "int i;", format(" SOME_MACRO {int i;} int i;")); +} + +TEST_F(FormatTest, LayoutNestedBlocks) { + verifyFormat("void AddOsStrings(unsigned bitmask) {\n" + " struct s {\n" + " int i;\n" + " };\n" + " s kBitsToOs[] = { { 10 } };\n" + " for (int i = 0; i < 10; ++i)\n" + " return;\n" + "}"); +} + //===----------------------------------------------------------------------===// // Line break tests. //===----------------------------------------------------------------------===// |