summaryrefslogtreecommitdiff
path: root/unittests/Format/FormatTestJava.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'unittests/Format/FormatTestJava.cpp')
-rw-r--r--unittests/Format/FormatTestJava.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/unittests/Format/FormatTestJava.cpp b/unittests/Format/FormatTestJava.cpp
index 76e82612e0fec..f12d7fba50593 100644
--- a/unittests/Format/FormatTestJava.cpp
+++ b/unittests/Format/FormatTestJava.cpp
@@ -155,6 +155,15 @@ TEST_F(FormatTestJava, ClassDeclarations) {
" void doStuff(int theStuff);\n"
" void doMoreStuff(int moreStuff);\n"
"}");
+ verifyFormat("class A {\n"
+ " public @interface SomeInterface {\n"
+ " int stuff;\n"
+ " void doMoreStuff(int moreStuff);\n"
+ " }\n"
+ "}");
+ verifyFormat("class A {\n"
+ " public @interface SomeInterface {}\n"
+ "}");
}
TEST_F(FormatTestJava, AnonymousClasses) {
@@ -443,6 +452,22 @@ TEST_F(FormatTestJava, MethodDeclarations) {
getStyleWithColumns(40));
}
+TEST_F(FormatTestJava, MethodReference) {
+ EXPECT_EQ(
+ "private void foo() {\n"
+ " f(this::methodReference);\n"
+ " f(C.super::methodReference);\n"
+ " Consumer<String> c = System.out::println;\n"
+ " Iface<Integer> mRef = Ty::<Integer>meth;\n"
+ "}",
+ format("private void foo() {\n"
+ " f(this ::methodReference);\n"
+ " f(C.super ::methodReference);\n"
+ " Consumer<String> c = System.out ::println;\n"
+ " Iface<Integer> mRef = Ty :: <Integer> meth;\n"
+ "}"));
+}
+
TEST_F(FormatTestJava, CppKeywords) {
verifyFormat("public void union(Type a, Type b);");
verifyFormat("public void struct(Object o);");