added tests for ArrayTypeStyleCheck
This commit is contained in:
parent
3dfa7b74b0
commit
2c3c80cdc5
|
|
@ -0,0 +1,23 @@
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Test case file for checkstyle.
|
||||
// Created: 2001
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
package com.puppycrawl.tools.checkstyle;
|
||||
|
||||
/**
|
||||
* Test case for ArrayTypeStyle (Java vs C)
|
||||
* @author lkuehne
|
||||
**/
|
||||
public class InputArrayTypeStyle
|
||||
{
|
||||
private int[] javaStyle = new int[0];
|
||||
private int cStyle[] = new int[0];
|
||||
|
||||
public static void mainJava(String[] aJavaStyle)
|
||||
{
|
||||
}
|
||||
|
||||
public static void mainC(String aCStyle[])
|
||||
{
|
||||
}
|
||||
}
|
||||
|
|
@ -60,6 +60,7 @@ import com.puppycrawl.tools.checkstyle.checks.UpperEllCheckTest;
|
|||
import com.puppycrawl.tools.checkstyle.checks.VisibilityModifierCheckTest;
|
||||
import com.puppycrawl.tools.checkstyle.checks.WhitespaceAfterCheckTest;
|
||||
import com.puppycrawl.tools.checkstyle.checks.WhitespaceAroundTest;
|
||||
import com.puppycrawl.tools.checkstyle.checks.ArrayTypeStyleCheckTest;
|
||||
import junit.framework.Test;
|
||||
import junit.framework.TestSuite;
|
||||
|
||||
|
|
@ -80,6 +81,7 @@ public class AllTests {
|
|||
//$JUnit-BEGIN$
|
||||
suite.addTest(new TestSuite(DetailASTTest.class));
|
||||
suite.addTest(new TestSuite(AbstractViolationReporterTest.class));
|
||||
suite.addTest(new TestSuite(ArrayTypeStyleCheckTest.class));
|
||||
suite.addTest(new TestSuite(AvoidInlineConditionalsCheckTest.class));
|
||||
suite.addTest(new TestSuite(AvoidStarImportTest.class));
|
||||
suite.addTest(new TestSuite(ConfigurationLoaderTest.class));
|
||||
|
|
|
|||
|
|
@ -0,0 +1,33 @@
|
|||
package com.puppycrawl.tools.checkstyle.checks;
|
||||
|
||||
import com.puppycrawl.tools.checkstyle.BaseCheckTestCase;
|
||||
import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
|
||||
|
||||
public class ArrayTypeStyleCheckTest
|
||||
extends BaseCheckTestCase
|
||||
{
|
||||
public void testJavaStyle()
|
||||
throws Exception
|
||||
{
|
||||
final DefaultConfiguration checkConfig =
|
||||
createCheckConfig(ArrayTypeStyleCheck.class);
|
||||
final String[] expected = {
|
||||
"14:23: Array brackets at illegal position.",
|
||||
"20:44: Array brackets at illegal position.",
|
||||
};
|
||||
verify(checkConfig, getPath("InputArrayTypeStyle.java"), expected);
|
||||
}
|
||||
|
||||
public void testCStyle()
|
||||
throws Exception
|
||||
{
|
||||
final DefaultConfiguration checkConfig =
|
||||
createCheckConfig(ArrayTypeStyleCheck.class);
|
||||
checkConfig.addAttribute("javaStyle", "false");
|
||||
final String[] expected = {
|
||||
"13:16: Array brackets at illegal position.",
|
||||
"16:39: Array brackets at illegal position.",
|
||||
};
|
||||
verify(checkConfig, getPath("InputArrayTypeStyle.java"), expected);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue