Skip to content

Commit

Permalink
Fix OneStatementPerLine on multiple field initialization bug, issue #…
Browse files Browse the repository at this point in the history
  • Loading branch information
MEZk authored and romani committed Jul 10, 2015
1 parent 6985c47 commit b405880
Show file tree
Hide file tree
Showing 9 changed files with 692 additions and 98 deletions.
1 change: 0 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1113,7 +1113,6 @@
<regex><pattern>.*.checks.coding.ModifiedControlVariableCheck</pattern><branchRate>91</branchRate><lineRate>97</lineRate></regex>
<regex><pattern>.*.checks.coding.MultipleStringLiteralsCheck</pattern><branchRate>90</branchRate><lineRate>96</lineRate></regex>
<regex><pattern>.*.checks.coding.MultipleVariableDeclarationsCheck</pattern><branchRate>96</branchRate><lineRate>100</lineRate></regex>
<regex><pattern>.*.checks.coding.OneStatementPerLineCheck</pattern><branchRate>93</branchRate><lineRate>100</lineRate></regex>
<regex><pattern>.*.checks.coding.OverloadMethodsDeclarationOrderCheck</pattern><branchRate>93</branchRate><lineRate>100</lineRate></regex>
<regex><pattern>.*.checks.coding.PackageDeclarationCheck</pattern><branchRate>75</branchRate><lineRate>85</lineRate></regex>
<regex><pattern>.*.checks.coding.ParameterAssignmentCheck</pattern><branchRate>80</branchRate><lineRate>96</lineRate></regex>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,41 +13,48 @@
import com.puppycrawl.tools.checkstyle.checks.coding.OneStatementPerLineCheck;

public class OneStatementPerLineTest extends BaseCheckTestSupport{

static ConfigurationBuilder builder;

@BeforeClass
public static void setConfigurationBuilder() throws CheckstyleException, IOException {
builder = new ConfigurationBuilder(new File("src/it/"));
}

@Test
public void oneStatmentTest() throws IOException, Exception {

String msg = getCheckMessage(OneStatementPerLineCheck.class, "multiple.statements.line");

final String[] expected = {
"45:18: " + msg,
"47:19: " + msg,
"49:40: " + msg,
"52:23: " + msg,
"53:33: " + msg,
"54:55: " + msg,
"63:11: " + msg,
"90:22: " + msg,
"92:23: " + msg,
"94:44: " + msg,
"97:27: " + msg,
"98:37: " + msg,
"99:59: " + msg,
"6:59: " + msg,
"58:21: " + msg,
"60:21: " + msg,
"62:42: " + msg,
"65:25: " + msg,
"66:35: " + msg,
"76:14: " + msg,
"103:25: " + msg,
"105:25: " + msg,
"107:46: " + msg,
"110:29: " + msg,
"111:39: " + msg,
"119:15: " + msg,
"131:23: " + msg,
"146:59: " + msg,
"155:4: " + msg,
"186:19: " + msg,
"204:15: " + msg,
"212:15: " + msg,
"224:6: " + msg,
"233:22: " + msg,
"323:39: " + msg,
};

Configuration checkConfig = builder.getCheckConfig("OneStatementPerLine");
String filePath = builder.getFilePath("OneStatementPerLineInput");

Integer[] warnList = builder.getLinesWithWarn(filePath);
verify(checkConfig, filePath, expected, warnList);
}
}


Loading

0 comments on commit b405880

Please sign in to comment.