Skip to content

Commit

Permalink
checkstyle#3202: Tests added and fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
kazachka committed Sep 3, 2016
1 parent 9676027 commit b02e237
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 4 deletions.
Expand Up @@ -452,7 +452,7 @@ private static boolean shouldCheckSeparationFromNextToken(DetailAST ast, char ne
&& ast.getFirstChild().getType() == TokenTypes.SEMI)
&& !isAnonymousInnerClassEnd(ast.getType(), nextChar)
&& !isPartOfDoubleBraceInitializerForNextToken(ast)
&& !(ast.getType() == TokenTypes.ARRAY_INIT);
&& !(ast.getType() == TokenTypes.ARRAY_INIT);
}

/**
Expand Down
Expand Up @@ -102,6 +102,9 @@ public void testIt()
"156:21: " + getCheckMessage(MSG_WS_NOT_FOLLOWED, ":"),
"262:14: " + getCheckMessage(MSG_WS_NOT_FOLLOWED, "}"),
"289:39: " + getCheckMessage(MSG_WS_NOT_PRECEDED, "{"),
"293:37: " + getCheckMessage(MSG_WS_NOT_PRECEDED, "{"),
//"293:55: " + getCheckMessage(MSG_WS_NOT_FOLLOWED, "}"),
"295:56: " + getCheckMessage(MSG_WS_NOT_PRECEDED, "{"),
};
verify(checkConfig, getPath("InputWhitespace.java"), expected);
}
Expand Down Expand Up @@ -252,7 +255,7 @@ public void testGetAcceptableTokens() {
final int[] actual = whitespaceAroundCheckObj.getAcceptableTokens();
final int[] expected = {
TokenTypes.ASSIGN,
TokenTypes.ARRAY_INIT,
TokenTypes.ARRAY_INIT,
TokenTypes.BAND,
TokenTypes.BAND_ASSIGN,
TokenTypes.BOR,
Expand Down
Expand Up @@ -23,7 +23,7 @@ class myFoo
private void foo()
{
int i = 0;
String[][] x = {{"foo"}};
String[][] x = { {"foo"} };
int len = 0;
String sequence = null;
for (int first = 0; first < len && matches(sequence.charAt(first)); first++) {}
Expand Down Expand Up @@ -68,4 +68,4 @@ private void foo()

class MyClass {

}
}
Expand Up @@ -289,5 +289,17 @@ public void arrayInitTest() {
final int[] COLORS = new int[]{5 };
// valid
final int[] COLORS1 = new int[] {5 };
//missing WS before and after inner array
final String[][] COLORS2 = {{"Green"}, {"Red"}};
//missing WS between "," and "{"
final String[][] COLORS21 = { {"Green", "Red"},{"White"} };
//valid
final String[][] COLORS22 = { {"White", "Yellow"}, {"Pink"} };
//valid
final String[][][] COLORS3 = { { {"Black", "Blue"}, {"Gray", "White"}},
{ {"Green", "Brown", "Magneta"}},
{ {"Red", "Purple", "Violet"}} };
//valid
final String[][][][] COLORS4 = { { { {"Orange"}, {"Green"}}, { {"Purple"}}}, { { {"Yellow"}}} };
}
}

0 comments on commit b02e237

Please sign in to comment.