You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by hi...@apache.org on 2007/08/03 09:52:55 UTC
svn commit: r562375 -
/harmony/standard/tools/check-junit-code/check-junit-code
Author: hindessm
Date: Fri Aug 3 00:52:54 2007
New Revision: 562375
URL: http://svn.apache.org/viewvc?view=rev&rev=562375
Log:
Added a few more checks.
Modified:
harmony/standard/tools/check-junit-code/check-junit-code
Modified: harmony/standard/tools/check-junit-code/check-junit-code
URL: http://svn.apache.org/viewvc/harmony/standard/tools/check-junit-code/check-junit-code?view=diff&rev=562375&r1=562374&r2=562375
==============================================================================
--- harmony/standard/tools/check-junit-code/check-junit-code (original)
+++ harmony/standard/tools/check-junit-code/check-junit-code Fri Aug 3 00:52:54 2007
@@ -129,6 +129,7 @@
(
assertEquals => \&check_assertEquals,
assertTrue => \&check_assertTrue,
+ assertNotNull => \&check_assertNotNull,
assertFalse => \&check_assertFalse,
fail => \&check_fail,
);
@@ -313,8 +314,13 @@
my $type = shift;
my $message = shift;
my $args = shift;
+ if ($args =~ /,\s*"[^"]+"\s*$/) {
+ return "final string argument?";
+ }
if ($args eq "false") {
return "should be fail (always true)";
+ } elsif ($args eq "true") {
+ return "never fails (always true)";
} elsif ($args =~ /\&\&/) {
return "consider using separate asserts for each '&&' component";
} elsif ($args =~ /^[^|&]+==\s*null$/ or
@@ -338,8 +344,13 @@
my $type = shift;
my $message = shift;
my $args = shift;
+ if ($args =~ /,\s*"[^"]+"\s*$/) {
+ return "final string argument?";
+ }
if ($args eq "true") {
return "should be fail (always false)";
+ } elsif ($args eq "false") {
+ return "never fails (always false)";
} elsif ($args =~ /^[^|&]+!=\s*null$/ or
$args =~ /^\s*null\s*!=[^|&]+$/) {
return "should use assertNotNull";
@@ -351,5 +362,16 @@
return "should use assertTrue";
} elsif ($args =~ /\|\|/) {
return "consider using separate asserts for each '||' component";
+ }
+}
+
+sub check_assertNotNull {
+ my $type = shift;
+ my $message = shift;
+ my $args = shift;
+ if ($args =~ /,\s*"[^"]+"\s*$/) {
+ return "final string argument?";
+ } elsif ($args eq 'null') {
+ return "should be fail (always null)";
}
}