Created test to show supporting double line wrap indent. #59
This commit is contained in:
parent
85c205ca68
commit
abc1ad977a
|
|
@ -29,6 +29,27 @@ import org.junit.Test;
|
|||
*/
|
||||
public class IndentationCheckTest extends BaseCheckTestSupport
|
||||
{
|
||||
@Test
|
||||
public void testAndroidStyle() throws Exception
|
||||
{
|
||||
final DefaultConfiguration checkConfig = createCheckConfig(IndentationCheck.class);
|
||||
checkConfig.addAttribute("basicOffset", "4");
|
||||
checkConfig.addAttribute("lineWrappingIndentation", "8");
|
||||
checkConfig.addAttribute("throwsIndent", "8");
|
||||
final String[] expected = {
|
||||
"28: 'extends' have incorrect indentation level 3, expected level should be 8.",
|
||||
"30: 'member def type' have incorrect indentation level 3, expected level should be 4.",
|
||||
"33: 'foo' have incorrect indentation level 8, expected level should be 12.",
|
||||
"36: 'int' have incorrect indentation level 8, expected level should be 12.",
|
||||
"39: 'true' have incorrect indentation level 13, expected level should be 16.",
|
||||
"42: '+' have incorrect indentation level 16, expected level should be 20.",
|
||||
"43: 'if' have incorrect indentation level 8, expected level should be 12.",
|
||||
"46: 'if rcurly' have incorrect indentation level 11, expected level should be 12.",
|
||||
"48: 'method def' child have incorrect indentation level 7, expected level should be 8.",
|
||||
};
|
||||
verify(checkConfig, getPath("indentation/InputAndroidStyle.java"), expected);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAnonClassesFromGuava() throws Exception
|
||||
{
|
||||
|
|
|
|||
|
|
@ -0,0 +1,52 @@
|
|||
package com.puppycrawl.tools.checkstyle.indentation;
|
||||
|
||||
class InputAndroidStyleCorrect
|
||||
extends FooForExtend { //correct
|
||||
|
||||
String string = foo("fooooooooooooooo", 0, false);
|
||||
|
||||
String string1 =
|
||||
foo("fooooooooooooooo", 0, false); //correct
|
||||
|
||||
String foo (String aStr,
|
||||
int aNnum, boolean aFlag) { //correct
|
||||
|
||||
if (true && true &&
|
||||
true && true) { //correct
|
||||
String string2 = foo("fooooooo"
|
||||
+ "oooooooo", 0, false); //correct
|
||||
if (false &&
|
||||
false && false) { //correct
|
||||
|
||||
}
|
||||
}
|
||||
return "string";
|
||||
}
|
||||
}
|
||||
|
||||
class InputAndroidStyleIncorrect
|
||||
extends FooForExtend { //incorrect
|
||||
|
||||
String string = foo("fooooooooooooooo", 0, false); //incorrect
|
||||
|
||||
String string1 =
|
||||
foo("fooooooooooooooo", 0, false); //incorrect
|
||||
|
||||
String foo (String aStr,
|
||||
int aNnum, boolean aFlag) { //incorrect
|
||||
|
||||
if (true && true &&
|
||||
true && true) { //incorrect
|
||||
|
||||
String string2 = foo("fooooooo"
|
||||
+ "oooooooo", 0, false); //incorrect
|
||||
if (false &&
|
||||
false && false) { //incorrect
|
||||
|
||||
} //incorrect
|
||||
}
|
||||
return "string"; //incorrect
|
||||
}
|
||||
}
|
||||
|
||||
class FooForExtend {}
|
||||
Loading…
Reference in New Issue