Watching Germany destroy a team in the 2002 world cup. Oh, also updating the
code coverage of the tests. :-)
This commit is contained in:
parent
4e49cc8d2a
commit
f3895598fe
|
|
@ -46,7 +46,7 @@ public class CheckerTest
|
|||
mConfig.setRCurly(RightCurlyOption.ALONE);
|
||||
}
|
||||
|
||||
protected String getPath(String aFilename)
|
||||
static String getPath(String aFilename)
|
||||
throws IOException
|
||||
{
|
||||
final File f = new File(System.getProperty("tests.dir"), aFilename);
|
||||
|
|
@ -151,6 +151,7 @@ public class CheckerTest
|
|||
filepath + ":156:21: ':' is not followed by whitespace.",
|
||||
};
|
||||
verify(c, filepath, expected);
|
||||
c.destroy();
|
||||
}
|
||||
|
||||
public void testWhitespaceCastParenOff()
|
||||
|
|
|
|||
|
|
@ -0,0 +1,45 @@
|
|||
package com.puppycrawl.tools.checkstyle;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
public class ConfigurationTest
|
||||
extends TestCase
|
||||
{
|
||||
public ConfigurationTest(String name)
|
||||
{
|
||||
super(name);
|
||||
}
|
||||
|
||||
public void test1() throws Exception
|
||||
{
|
||||
final Properties p = new Properties();
|
||||
p.setProperty(Defn.HEADER_FILE_PROP, CheckerTest.getPath("java.header"));
|
||||
p.setProperty(Defn.MAX_FILE_LENGTH_PROP, "a");
|
||||
p.setProperty(Defn.MAX_LINE_LENGTH_PROP, "66");
|
||||
p.setProperty(Defn.ALLOW_TABS_PROP, "true");
|
||||
p.setProperty(Defn.LCURLY_METHOD_PROP, "ignore");
|
||||
p.setProperty(Defn.LCURLY_OTHER_PROP, "claiea");
|
||||
p.setProperty(Defn.RCURLY_PROP, "ignore");
|
||||
p.setProperty(Defn.CATCH_BLOCK_PROP, "ignore");
|
||||
p.setProperty(Defn.PAREN_PAD_PROP, "ignore");
|
||||
final Configuration c = new Configuration(p, System.out);
|
||||
assertNotNull(c);
|
||||
assertEquals(66, c.getMaxLineLength());
|
||||
assertEquals(-1, c.getHeaderIgnoreLineNo());
|
||||
assertEquals(true, c.isAllowTabs());
|
||||
c.setHeaderIgnoreLineNo(666);
|
||||
assertEquals(666, c.getHeaderIgnoreLineNo());
|
||||
}
|
||||
|
||||
public void test2() throws Exception
|
||||
{
|
||||
final Properties p = new Properties();
|
||||
p.setProperty(Defn.RCURLY_PROP, "claira");
|
||||
p.setProperty(Defn.CATCH_BLOCK_PROP, "is great");
|
||||
p.setProperty(Defn.PAREN_PAD_PROP, "at sleeping");
|
||||
final Configuration c = new Configuration(p, System.out);
|
||||
assertNotNull(c);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
package com.puppycrawl.tools.checkstyle;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import antlr.Token;
|
||||
|
||||
public class MyCommonASTTest
|
||||
extends TestCase
|
||||
{
|
||||
public MyCommonASTTest(String name)
|
||||
{
|
||||
super(name);
|
||||
}
|
||||
|
||||
public void testMisc()
|
||||
{
|
||||
final MyCommonAST o = new MyCommonAST();
|
||||
assertNotNull(o);
|
||||
o.initialize(new Token());
|
||||
assertEquals("{Text = '<no text>', Line = 0, Column = -1}", o.toString());
|
||||
}
|
||||
}
|
||||
|
|
@ -27,6 +27,11 @@ public class UtilsTest
|
|||
|
||||
String s4 = " \t ";
|
||||
assertEquals(9, Utils.lengthExpandedTabs(s4, s4.length(), 8));
|
||||
|
||||
assertEquals(0, Utils.lengthMinusTrailingWhitespace(""));
|
||||
assertEquals(0, Utils.lengthMinusTrailingWhitespace(" \t "));
|
||||
assertEquals(3, Utils.lengthMinusTrailingWhitespace(" 23"));
|
||||
assertEquals(3, Utils.lengthMinusTrailingWhitespace(" 23 \t "));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue