From 0375637528f2323a177c47f8fa7b2c60eb118179 Mon Sep 17 00:00:00 2001 From: Shlomi Fish Date: Sat, 31 Dec 2016 12:08:37 +0200 Subject: [PATCH] Convert trailing space test to TAP/prove. --- fortune-mod/run-tests.pl | 8 +++- .../trailing-space-and-CRs.t} | 37 +++++-------------- 2 files changed, 17 insertions(+), 28 deletions(-) rename fortune-mod/tests/{trailing-space-and-CRs.pl => t/trailing-space-and-CRs.t} (80%) diff --git a/fortune-mod/run-tests.pl b/fortune-mod/run-tests.pl index a93acb5..9752c5f 100644 --- a/fortune-mod/run-tests.pl +++ b/fortune-mod/run-tests.pl @@ -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")]}); diff --git a/fortune-mod/tests/trailing-space-and-CRs.pl b/fortune-mod/tests/t/trailing-space-and-CRs.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 7e61a5c..fcf1a14 100644 --- a/fortune-mod/tests/trailing-space-and-CRs.pl +++ b/fortune-mod/tests/t/trailing-space-and-CRs.t @@ -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__ -- 2.40.0