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.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/clang/unittests/Format/FormatTestJava.cpp b/clang/unittests/Format/FormatTestJava.cpp
index 202d603..6da5f4f 100644
--- a/clang/unittests/Format/FormatTestJava.cpp
+++ b/clang/unittests/Format/FormatTestJava.cpp
@@ -603,6 +603,21 @@ TEST_F(FormatTestJava, ShortFunctions) {
Style);
}
+TEST_F(FormatTestJava, ConfigurableSpacesInSquareBrackets) {
+ FormatStyle Spaces = getLLVMStyle(FormatStyle::LK_Java);
+
+ verifyFormat("Object[] arguments", Spaces);
+ verifyFormat("final Class<?>[] types = new Class<?>[numElements];", Spaces);
+ verifyFormat("types[i] = arguments[i].getClass();", Spaces);
+
+ Spaces.SpacesInSquareBrackets = true;
+
+ verifyFormat("Object[ ] arguments", Spaces);
+ verifyFormat("final Class<?>[ ] types = new Class<?>[ numElements ];",
+ Spaces);
+ verifyFormat("types[ i ] = arguments[ i ].getClass();", Spaces);
+}
+
} // namespace
} // namespace test
} // namespace format