From 50b4bd7c0e3b5bcb3f1fd64c82d01a85109fa8da Mon Sep 17 00:00:00 2001 From: Daniel Jasper Date: Sun, 2 Nov 2014 19:16:41 +0000 Subject: 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 --- clang/unittests/Format/FormatTestJava.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'clang/unittests/Format/FormatTestJava.cpp') 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) { -- cgit v1.1