]> granicus.if.org Git - fortune-mod/commitdiff
Convert trailing space test to TAP/prove.
authorShlomi Fish <shlomif@shlomifish.org>
Sat, 31 Dec 2016 10:08:37 +0000 (12:08 +0200)
committerShlomi Fish <shlomif@shlomifish.org>
Sat, 31 Dec 2016 10:08:37 +0000 (12:08 +0200)
fortune-mod/run-tests.pl
fortune-mod/tests/t/trailing-space-and-CRs.t [moved from fortune-mod/tests/trailing-space-and-CRs.pl with 80% similarity]

index a93acb58c5fb036e07d73645991dc476ea90e7c4..9752c5f88ce6392b17c865c2e5a546572e5e8736 100644 (file)
@@ -32,5 +32,11 @@ sub do_system
         die "Running [@$cmd] failed!";
     }
 }
-do_system({cmd => [$^X , "$src_dir/tests/trailing-space-and-CRs.pl"]});
+
+# Cancelling because it's now part of the prove-based tests.
+if (0)
+{
+    do_system({cmd => [$^X , "$src_dir/tests/trailing-space-and-CRs.pl"]});
+}
+
 do_system({cmd => ['prove', glob("$src_dir/tests/t/*.t")]});
similarity index 80%
rename from fortune-mod/tests/trailing-space-and-CRs.pl
rename to fortune-mod/tests/t/trailing-space-and-CRs.t
index 7e61a5cf3b77d8d8790f0b0bc681bfc572536c1c..fcf1a1483d0c8347f4b8c9b454e5271f799b0112 100644 (file)
@@ -3,8 +3,11 @@
 use strict;
 use warnings;
 
-use File::Find::Object;
+use File::Find::Object ();
 use IO::All qw/ io /;
+use Test::More tests => 3;
+use Test::Differences (qw( eq_or_diff ));
+
 
 my $tree = File::Find::Object->new({}, $ENV{SRC_DIR});
 
@@ -55,32 +58,12 @@ while (my $r = $tree->next_obj())
     }
 }
 
-if (@cr_results or @trailing_whitespace_results or @tabs_results)
-{
-    print "The following files contain carriage returns:\n\n";
-    foreach my $r (@cr_results)
-    {
-        print "$r\n";
-    }
-
-    print "The following files contain trailing whitespace:\n\n";
-    foreach my $r (@trailing_whitespace_results)
-    {
-        print "$r\n";
-    }
-
-    print "The following source files contain tabs:\n\n";
-    foreach my $r (@tabs_results)
-    {
-        print "$r\n";
-    }
-    exit(-1);
-}
-else
-{
-    print "CR/trailing space sanity is OK.\n";
-    exit(0);
-}
+# TEST
+eq_or_diff(\@cr_results, [], "Files containing carriage returns.");
+# TEST
+eq_or_diff(\@trailing_whitespace_results, [], "Files containing trailing whitespace.");
+# TEST
+eq_or_diff(\@tabs_results, [], "Source files containing tabs.");
 
 __END__