summaryrefslogtreecommitdiffstats
path: root/clang/unittests/Format/FormatTest.cpp
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2013-08-30 10:10:19 +0000
committerDaniel Jasper <djasper@google.com>2013-08-30 10:10:19 +0000
commitb71508727859e1aef49c8f08e85cb3865a51a417 (patch)
tree6a6014095fe1ff6fd9a11bb10cfb4a9f6e182d34 /clang/unittests/Format/FormatTest.cpp
parent1cc6cce9a625764f17c061b68e6092089e30e1f0 (diff)
downloadbcm5719-llvm-b71508727859e1aef49c8f08e85cb3865a51a417.tar.gz
bcm5719-llvm-b71508727859e1aef49c8f08e85cb3865a51a417.zip
clang-format: Improve recovery from enums with errors.
Before: namespace n { enum Type { One, Two, // missing }; int i; } void g() { } After: namespace n { enum Type { One, Two, // missing }; int i; } void g() {} llvm-svn: 189662
Diffstat (limited to 'clang/unittests/Format/FormatTest.cpp')
-rw-r--r--clang/unittests/Format/FormatTest.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp
index 9c8efd882c4..aef1dae6fdf 100644
--- a/clang/unittests/Format/FormatTest.cpp
+++ b/clang/unittests/Format/FormatTest.cpp
@@ -1519,6 +1519,20 @@ TEST_F(FormatTest, FormatsEnum) {
verifyFormat("enum X f() {\n a();\n return 42;\n}");
}
+TEST_F(FormatTest, FormatsEnumsWithErrors) {
+ verifyFormat("enum Type {\n"
+ " One = 0;\n" // These semicolons should be commas.
+ " Two = 1;\n"
+ "};");
+ verifyFormat("namespace n {\n"
+ "enum Type {\n"
+ " One,\n"
+ " Two,\n" // missing };
+ " int i;\n"
+ "}\n"
+ "void g() {}");
+}
+
TEST_F(FormatTest, FormatsEnumStruct) {
verifyFormat("enum struct {\n"
" Zero,\n"
OpenPOWER on IntegriCloud