Tweaking JUnit tests to be more complete

git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@4658 51baf565-9d33-0410-a72c-fc3788e3496d
This commit is contained in:
Allan Caplan
2006-10-15 00:16:15 +00:00
parent 302788631a
commit d21442b15c

View File

@ -10,6 +10,8 @@ public class SuspiciousOctalEscapeTest extends SimpleAggregatorTst {
runTests(new TestDescriptor[]{
new TestDescriptor(TEST1, "ok use of octal", 0, new SuspiciousOctalEscape()),
new TestDescriptor(TEST2, "should be flagged", 1, new SuspiciousOctalEscape()),
new TestDescriptor(TEST3, "should be flagged - different octal", 1, new SuspiciousOctalEscape()),
new TestDescriptor(TEST4, "should be flagged - different octal", 1, new SuspiciousOctalEscape()),
});
}
@ -26,4 +28,19 @@ public class SuspiciousOctalEscapeTest extends SimpleAggregatorTst {
" System.out.println(\"foo = \\128\");" + PMD.EOL +
" }" + PMD.EOL +
"}";
private static final String TEST3 =
"public class Foo {" + PMD.EOL +
" void bar() {" + PMD.EOL +
" System.out.println(\"foo = \\0008\");" + PMD.EOL +
" }" + PMD.EOL +
"}";
private static final String TEST4 =
"public class Foo {" + PMD.EOL +
" void bar() {" + PMD.EOL +
" System.out.println(\"foo = \\4008\");" + PMD.EOL +
" }" + PMD.EOL +
"}";
}