Refactoring to put the unit tests for the checks into the
proper package. Side note: Eclipse makes this refactoring very easy to do. As part of the move it performs all the CVS operations that are required for moving a file. I actually like the Eclipse support for CVS, I thought nothing would beat good old Emacs.
This commit is contained in:
parent
76ae239351
commit
5190c8f656
|
|
@ -1,5 +1,6 @@
|
|||
package com.puppycrawl.tools.checkstyle;
|
||||
|
||||
import com.puppycrawl.tools.checkstyle.checks.GenericIllegalRegexpCheckTest;
|
||||
import junit.framework.Test;
|
||||
import junit.framework.TestSuite;
|
||||
|
||||
|
|
|
|||
|
|
@ -68,6 +68,12 @@ public abstract class BaseCheckTestCase
|
|||
return f.getCanonicalPath();
|
||||
}
|
||||
|
||||
protected void verify(Configuration aConfig, String aFileName, String[] aExpected)
|
||||
throws Exception
|
||||
{
|
||||
verify(createChecker(aConfig), aFileName, aFileName, aExpected);
|
||||
}
|
||||
|
||||
protected void verify(Checker aC, String aFileName, String[] aExpected)
|
||||
throws Exception
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.puppycrawl.tools.checkstyle;
|
||||
package com.puppycrawl.tools.checkstyle.checks;
|
||||
|
||||
import com.puppycrawl.tools.checkstyle.checks.GenericIllegalRegexpCheck;
|
||||
import com.puppycrawl.tools.checkstyle.BaseCheckTestCase;
|
||||
import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
|
||||
|
||||
public class GenericIllegalRegexpCheckTest
|
||||
extends BaseCheckTestCase
|
||||
|
|
@ -12,11 +13,10 @@ public class GenericIllegalRegexpCheckTest
|
|||
final DefaultConfiguration checkConfig =
|
||||
createCheckConfig(GenericIllegalRegexpCheck.class);
|
||||
checkConfig.addAttribute("format", illegal);
|
||||
final Checker c = createChecker(checkConfig);
|
||||
final String fname = getPath("InputSemantic.java");
|
||||
final String[] expected = {
|
||||
"69: Line matches the illegal pattern '" + illegal + "'."
|
||||
};
|
||||
verify(c, fname, expected);
|
||||
verify(checkConfig, fname, expected);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue