aboutsummaryrefslogtreecommitdiff
path: root/clang/unittests/Format/FormatTestJava.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/unittests/Format/FormatTestJava.cpp')
-rw-r--r--clang/unittests/Format/FormatTestJava.cpp38
1 files changed, 38 insertions, 0 deletions
diff --git a/clang/unittests/Format/FormatTestJava.cpp b/clang/unittests/Format/FormatTestJava.cpp
index 44a7910..0ee398a 100644
--- a/clang/unittests/Format/FormatTestJava.cpp
+++ b/clang/unittests/Format/FormatTestJava.cpp
@@ -116,6 +116,44 @@ TEST_F(FormatTestJava, EnumDeclarations) {
" void f() {\n"
" }\n"
"}");
+ verifyFormat("public class SomeClass implements SomeInterface {\n"
+ " enum SomeThing { ABC, CDE }\n"
+ " void f() {\n"
+ " }\n"
+ "}");
+ verifyFormat("enum SomeThing {\n"
+ " ABC,\n"
+ " CDE;\n"
+ " void f() {\n"
+ " }\n"
+ "}");
+ verifyFormat("enum SomeThing {\n"
+ " ABC(1, \"ABC\"),\n"
+ " CDE(2, \"CDE\");\n"
+ " Something(int i, String s) {\n"
+ " }\n"
+ "}");
+ verifyFormat("enum SomeThing {\n"
+ " ABC(new int[]{1, 2}),\n"
+ " CDE(new int[]{2, 3});\n"
+ " Something(int[] i) {\n"
+ " }\n"
+ "}");
+ verifyFormat("public enum SomeThing {\n"
+ " ABC {\n"
+ " public String toString() {\n"
+ " return \"ABC\";\n"
+ " }\n"
+ " },\n"
+ " CDE {\n"
+ " @Override\n"
+ " public String toString() {\n"
+ " return \"CDE\";\n"
+ " }\n"
+ " };\n"
+ " public void f() {\n"
+ " }\n"
+ "}");
}
TEST_F(FormatTestJava, ThrowsDeclarations) {