aboutsummaryrefslogtreecommitdiff
path: root/unittests/Format/FormatTest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'unittests/Format/FormatTest.cpp')
-rw-r--r--unittests/Format/FormatTest.cpp51
1 files changed, 51 insertions, 0 deletions
diff --git a/unittests/Format/FormatTest.cpp b/unittests/Format/FormatTest.cpp
index 997a55353b..df0b2962f2 100644
--- a/unittests/Format/FormatTest.cpp
+++ b/unittests/Format/FormatTest.cpp
@@ -2544,5 +2544,56 @@ TEST_F(FormatTest, ObjCLiterals) {
}
+TEST_F(FormatTest, ReformatRegionAdjustsIndent) {
+ EXPECT_EQ("{\n"
+ "{\n"
+ "a;\n"
+ "b;\n"
+ "}\n"
+ "}", format("{\n"
+ "{\n"
+ "a;\n"
+ " b;\n"
+ "}\n"
+ "}", 13, 2, getLLVMStyle()));
+ EXPECT_EQ("{\n"
+ "{\n"
+ " a;\n"
+ "b;\n"
+ "}\n"
+ "}", format("{\n"
+ "{\n"
+ " a;\n"
+ "b;\n"
+ "}\n"
+ "}", 9, 2, getLLVMStyle()));
+ EXPECT_EQ("{\n"
+ "{\n"
+ "public:\n"
+ " b;\n"
+ "}\n"
+ "}", format("{\n"
+ "{\n"
+ "public:\n"
+ " b;\n"
+ "}\n"
+ "}", 17, 2, getLLVMStyle()));
+ EXPECT_EQ("{\n"
+ "{\n"
+ "a;\n"
+ "}\n"
+ "{\n"
+ " b;\n"
+ "}\n"
+ "}", format("{\n"
+ "{\n"
+ "a;\n"
+ "}\n"
+ "{\n"
+ " b;\n"
+ "}\n"
+ "}", 22, 2, getLLVMStyle()));
+}
+
} // end namespace tooling
} // end namespace clang