aboutsummaryrefslogtreecommitdiff
path: root/clang/unittests/Format/FormatTestJava.cpp
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2014-11-02 19:16:41 +0000
committerDaniel Jasper <djasper@google.com>2014-11-02 19:16:41 +0000
commit50b4bd7c0e3b5bcb3f1fd64c82d01a85109fa8da (patch)
treeaabdae3c950e0cd9573490dbdd99569abfda6a2b /clang/unittests/Format/FormatTestJava.cpp
parent23e987766b97d75fcad57f8a0f7ac8e4790e09d8 (diff)
downloadllvm-50b4bd7c0e3b5bcb3f1fd64c82d01a85109fa8da.zip
llvm-50b4bd7c0e3b5bcb3f1fd64c82d01a85109fa8da.tar.gz
llvm-50b4bd7c0e3b5bcb3f1fd64c82d01a85109fa8da.tar.bz2
clang-format: [Java] Don't break after extends/implements.
Before: abstract class SomeClass extends SomeOtherClass implements SomeInterface {} After: abstract class SomeClass extends SomeOtherClass implements SomeInterface {} llvm-svn: 221103
Diffstat (limited to 'clang/unittests/Format/FormatTestJava.cpp')
-rw-r--r--clang/unittests/Format/FormatTestJava.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/clang/unittests/Format/FormatTestJava.cpp b/clang/unittests/Format/FormatTestJava.cpp
index 4f9a3dc..73a1848 100644
--- a/clang/unittests/Format/FormatTestJava.cpp
+++ b/clang/unittests/Format/FormatTestJava.cpp
@@ -37,6 +37,12 @@ protected:
return format(Code, 0, Code.size(), Style);
}
+ static FormatStyle getStyleWithColumns(unsigned ColumnLimit) {
+ FormatStyle Style = getGoogleStyle(FormatStyle::LK_Java);
+ Style.ColumnLimit = ColumnLimit;
+ return Style;
+ }
+
static void verifyFormat(
llvm::StringRef Code,
const FormatStyle &Style = getGoogleStyle(FormatStyle::LK_Java)) {
@@ -58,6 +64,19 @@ TEST_F(FormatTestJava, ClassDeclarations) {
" }\n"
"}");
verifyFormat("public class A extends B.C {}");
+
+ verifyFormat("abstract class SomeClass extends SomeOtherClass\n"
+ " implements SomeInterface {}",
+ getStyleWithColumns(60));
+ verifyFormat("abstract class SomeClass\n"
+ " extends SomeOtherClass\n"
+ " implements SomeInterface {}",
+ getStyleWithColumns(40));
+ verifyFormat("abstract class SomeClass\n"
+ " extends SomeOtherClass\n"
+ " implements SomeInterface,\n"
+ " AnotherInterface {}",
+ getStyleWithColumns(40));
}
TEST_F(FormatTestJava, ThrowsDeclarations) {