diff options
author | Todd Rinaldo <toddr@cpan.org> | 2020-10-13 12:30:32 -0500 |
---|---|---|
committer | Todd Rinaldo <toddr@cpan.org> | 2020-10-13 17:49:23 -0500 |
commit | 81c73c1114c366c813689c351023a3f2cc39e50d (patch) | |
tree | c065aab0613fc30e48afc94e741327d82f4dcdb1 /t | |
parent | 551856fd362817d07a3df5400d749676378a6999 (diff) | |
download | perl-81c73c1114c366c813689c351023a3f2cc39e50d.tar.gz |
Fix t/test.pl and t/TEST to be strict compliant.
So tests can run with -Dusedefaultstrict
Diffstat (limited to 't')
-rwxr-xr-x | t/TEST | 3 | ||||
-rw-r--r-- | t/test.pl | 17 |
2 files changed, 12 insertions, 8 deletions
@@ -178,7 +178,8 @@ if ($show_elapsed_time) { require Time::HiRes } my %timings = (); # testname => [@et] pairs if $show_elapsed_time. # Roll your own File::Find! -sub _find_tests { our @found=(); push @ARGV, _find_files('\.t$', $_[0]) } +our @found; +sub _find_tests { @found=(); push @ARGV, _find_files('\.t$', $_[0]) } sub _find_files { my($patt, @dirs) = @_; for my $dir (@dirs) { @@ -20,7 +20,7 @@ # will be worked over by t/op/inc.t $| = 1; -$Level = 1; +our $Level = 1; my $test = 1; my $planned; my $noplan; @@ -30,9 +30,11 @@ my $Perl; # Safer version of $^X set by which_perl() $::IS_ASCII = ord 'A' == 65; $::IS_EBCDIC = ord 'A' == 193; -$TODO = 0; -$NO_ENDING = 0; -$Tests_Are_Passing = 1; +# This is 'our' to enable harness to account for TODO-ed tests in +# overall grade of PASS or FAIL +our $TODO = 0; +our $NO_ENDING = 0; +our $Tests_Are_Passing = 1; # Use this instead of print to avoid interference while testing globals. sub _print { @@ -1023,7 +1025,7 @@ sub _fresh_perl { # Use the first line of the program as a name if none was given unless( $name ) { - ($first_line, $name) = $prog =~ /^((.{1,50}).*)/; + (my $first_line, $name) = $prog =~ /^((.{1,50}).*)/; $name = $name . '...' if length $first_line > length $name; } @@ -1111,6 +1113,7 @@ sub fresh_perl_like { # If the global variable $FATAL is true then OPTION fatal is the # default. +our $FATAL; sub _setup_one_file { my $fh = shift; # Store the filename as a program that started at line 0. @@ -1435,7 +1438,7 @@ sub can_ok ($@) { sub new_ok { my($class, $args, $obj_name) = @_; $args ||= []; - $object_name = "The object" unless defined $obj_name; + $obj_name = "The object" unless defined $obj_name; local $Level = $Level + 1; @@ -1444,7 +1447,7 @@ sub new_ok { my $error = $@; if($ok) { - object_ok($obj, $class, $object_name); + object_ok($obj, $class, $obj_name); } else { ok( 0, "new() died" ); |