Added to improve code coverage. Trying out Clover (www.thecortex.org/clover).

This commit is contained in:
Oliver Burn 2002-05-31 13:58:02 +00:00
parent acb49a1e58
commit 4e49cc8d2a
6 changed files with 137 additions and 0 deletions

View File

@ -0,0 +1,21 @@
package com.puppycrawl.tools.checkstyle;
import junit.framework.TestCase;
public class JavadocTagTest
extends TestCase
{
public JavadocTagTest(String name)
{
super(name);
}
public void testMisc()
{
final JavadocTag o = new JavadocTag(666, "@fred");
assertNotNull(o);
assertEquals("{Tag = '@fred', lineNo = 666, Arg1 = 'null'}",
o.toString());
assertEquals(false, o.isAuthorTag());
}
}

View File

@ -0,0 +1,19 @@
package com.puppycrawl.tools.checkstyle;
import junit.framework.TestCase;
public class LineTextTest
extends TestCase
{
public LineTextTest(String name)
{
super(name);
}
public void testMisc()
{
final LineText o = new LineText(666, 667, "claira");
assertNotNull(o);
assertEquals("{Text = 'claira', Line = 666, Column = 667}", o.toString());
}
}

View File

@ -0,0 +1,21 @@
package com.puppycrawl.tools.checkstyle;
import junit.framework.TestCase;
public class MethodSignatureTest
extends TestCase
{
public MethodSignatureTest(String name)
{
super(name);
}
public void testMisc()
{
final MethodSignature o = new MethodSignature();
assertNotNull(o);
final MyCommonAST ret = new MyCommonAST();
o.setReturnType(ret);
assertEquals(ret, o.getReturnType());
}
}

View File

@ -0,0 +1,21 @@
package com.puppycrawl.tools.checkstyle;
import junit.framework.TestCase;
public class MyModifierSetTest
extends TestCase
{
public MyModifierSetTest(String name)
{
super(name);
}
public void testMisc()
{
final MyModifierSet o = new MyModifierSet();
assertNotNull(o);
assertEquals("MyModifierSet [ ]", o.toString());
o.addModifier(new MyCommonAST());
assertEquals("MyModifierSet [ null ]", o.toString());
}
}

View File

@ -0,0 +1,28 @@
package com.puppycrawl.tools.checkstyle;
import junit.framework.TestCase;
public class ScopeTest
extends TestCase
{
public ScopeTest(String name)
{
super(name);
}
public void testMisc()
{
final Scope o = Scope.getInstance("public");
assertNotNull(o);
assertEquals("Scope[1 (public)]", o.toString());
assertEquals("public", o.getName());
try {
Scope.getInstance("unknown");
fail();
}
catch (IllegalArgumentException e) {
// As expected
}
}
}

View File

@ -0,0 +1,27 @@
package com.puppycrawl.tools.checkstyle;
import junit.framework.TestCase;
import java.io.IOException;
public class StringArrayReaderTest
extends TestCase
{
public StringArrayReaderTest(String name)
{
super(name);
}
public void testMisc()
{
final StringArrayReader o = new StringArrayReader(new String[] {""});
assertNotNull(o);
o.close();
try {
o.read();
fail();
}
catch (IOException e) {
}
}
}