diff options
author | Todd Rinaldo <toddr@cpan.org> | 2020-09-30 11:25:01 -0500 |
---|---|---|
committer | Todd Rinaldo <toddr@cpan.org> | 2020-10-07 10:09:00 -0500 |
commit | 2bc27c6c0985d4dbcc8c43d214bff2352e58a121 (patch) | |
tree | 504ab18dadf387eafe854125cf49459e4f8a2274 /dist/Data-Dumper/t | |
parent | 43f856bae111d54f354ee7393baba1cf1617a769 (diff) | |
download | perl-2bc27c6c0985d4dbcc8c43d214bff2352e58a121.tar.gz |
Make Data::Dumper strict and warnings compliant
Diffstat (limited to 'dist/Data-Dumper/t')
25 files changed, 198 insertions, 118 deletions
diff --git a/dist/Data-Dumper/t/bless.t b/dist/Data-Dumper/t/bless.t index 364b6150a3..f547721b54 100644 --- a/dist/Data-Dumper/t/bless.t +++ b/dist/Data-Dumper/t/bless.t @@ -1,5 +1,8 @@ #!perl +use strict; +use warnings; + use Test::More 0.60; # Test::More 0.60 required because: @@ -30,6 +33,7 @@ $VAR1 = bless( {}, 'a\'b' ); PERL is($dt, $o, "package name in bless is escaped if needed"); +add_my_to_dump( \$dt ); is_deeply(scalar eval($dt), $t, "eval reverts dump"); } @@ -41,6 +45,7 @@ $VAR1 = bless( {}, 'a\\' ); PERL is($dt, $o, "package name in bless is escaped if needed"); +add_my_to_dump( \$dt ); is_deeply(scalar eval($dt), $t, "eval reverts dump"); } SKIP: { @@ -60,3 +65,11 @@ is($dt, $o, "We can dump blessed qr//'s properly"); } } # END sub run_tests_for_bless() + +sub add_my_to_dump { + my $s = shift; + + $$s =~ s{^(\s*)(\$VAR)}{$1 my $2}mg; + + return; +} diff --git a/dist/Data-Dumper/t/bless_var_method.t b/dist/Data-Dumper/t/bless_var_method.t index 7af4cdbaf4..ba720b9bf0 100644 --- a/dist/Data-Dumper/t/bless_var_method.t +++ b/dist/Data-Dumper/t/bless_var_method.t @@ -1,9 +1,13 @@ #!./perl -w # t/bless.t - Test Bless() +use strict; +use warnings; + +use Config; + BEGIN { if ($ENV{PERL_CORE}){ - require Config; import Config; no warnings 'once'; if ($Config{'extensions'} !~ /\bData\/Dumper\b/) { print "1..0 # Skip: Data::Dumper was not built\n"; @@ -12,8 +16,6 @@ BEGIN { } } -use strict; - use Data::Dumper; use Test::More tests => 8; use lib qw( ./t/lib ); diff --git a/dist/Data-Dumper/t/bugs.t b/dist/Data-Dumper/t/bugs.t index 5db82dad32..e1e1eabe75 100644 --- a/dist/Data-Dumper/t/bugs.t +++ b/dist/Data-Dumper/t/bugs.t @@ -2,8 +2,12 @@ # # regression tests for old bugs that do not fit other categories +use strict; +use warnings; + +use Config; + BEGIN { - require Config; import Config; no warnings 'once'; if ($Config{'extensions'} !~ /\bData\/Dumper\b/) { print "1..0 # Skip: Data::Dumper was not built\n"; @@ -11,7 +15,6 @@ BEGIN { } } -use strict; use Test::More tests => 24; use Data::Dumper; diff --git a/dist/Data-Dumper/t/deparse.t b/dist/Data-Dumper/t/deparse.t index cddde8cb6e..e4118e1969 100644 --- a/dist/Data-Dumper/t/deparse.t +++ b/dist/Data-Dumper/t/deparse.t @@ -1,10 +1,13 @@ #!./perl -w # t/deparse.t - Test Deparse() +use strict; +use warnings; + +use Config; + BEGIN { if ($ENV{PERL_CORE}){ - require Config; import Config; - no warnings 'once'; if ($Config{'extensions'} !~ /\bData\/Dumper\b/) { print "1..0 # Skip: Data::Dumper was not built\n"; exit 0; @@ -12,8 +15,6 @@ BEGIN { } } -use strict; - use Data::Dumper; use Test::More tests => 16; use lib qw( ./t/lib ); diff --git a/dist/Data-Dumper/t/dumper.t b/dist/Data-Dumper/t/dumper.t index bb01154fcc..a079ab6273 100644 --- a/dist/Data-Dumper/t/dumper.t +++ b/dist/Data-Dumper/t/dumper.t @@ -3,26 +3,28 @@ # testsuite for Data::Dumper # -BEGIN { - require Config; import Config; - if ($Config{'extensions'} !~ /\bData\/Dumper\b/) { - print "1..0 # Skip: Data::Dumper was not built\n"; - exit 0; - } -} - -# Since Perl 5.8.1 because otherwise hash ordering is really random. -local $Data::Dumper::Sortkeys = 1; +use strict; +use warnings; use Data::Dumper; use Config; +# Since Perl 5.8.1 because otherwise hash ordering is really random. +$Data::Dumper::Sortkeys = 1; $Data::Dumper::Pad = "#"; + my $TMAX; my $XS; my $TNUM = 0; my $WANT = ''; +our ( @a, $c, $d, $foo, @foo, %foo, @globs, $v, $ping, %ping ); +our ( @dogs, %kennel, $mutts ); + +our ( @numbers, @strings ); +our ( @numbers_s, @numbers_i, @numbers_is, @numbers_n, @numbers_ns, @numbers_ni, @numbers_nis ); +our ( @strings_s, @strings_i, @strings_is, @strings_n, @strings_ns, @strings_ni, @strings_nis ); + # Perl 5.16 was the first version that correctly handled Unicode in typeglob # names. Tests for how globs are dumped must revise their expectations # downwards when run on earlier Perls. @@ -96,23 +98,37 @@ sub convert_to_native($) { sub TEST { my $string = shift; my $name = shift; - my $t = eval $string; + my $t; + { + no strict; + $t = eval $string; + } + $t = '' unless defined $t; ++$TNUM; $t =~ s/([A-Z]+)\(0x[0-9a-f]+\)/$1(0xdeadbeef)/g if ($WANT =~ /deadbeef/); $name = $name ? " - $name" : ''; - print( ($t eq $WANT and not $@) ? "ok $TNUM$name\n" - : "not ok $TNUM$name\n--Expected--\n$WANT\n--Got--\n$@$t\n"); + my $ok = ($t eq $WANT and not $@); + print( $ok ? "ok $TNUM$name\n" + : "not ok $TNUM X$name\n--Expected--\n$WANT\n--Got--\n$@$t\n"); ++$TNUM; - eval "$t"; - print $@ ? "not ok $TNUM\n# \$@ says: $@\n" : "ok $TNUM - no eval error\n"; + { + no strict; + eval "$t"; + } + print $@ ? "not ok $TNUM YY\n# \$@ says: $@\n" : "ok $TNUM - no eval error\n"; - $t = eval $string; + { + no strict; + $t = eval $string; + } + $t = '' unless defined $t; ++$TNUM; $t =~ s/([A-Z]+)\(0x[0-9a-f]+\)/$1(0xdeadbeef)/g if ($WANT =~ /deadbeef/); - print( ($t eq $WANT and not $@) ? "ok $TNUM - works a 2nd time after intervening eval\n" + $ok = ($t eq $WANT and not $@); + print( $ok ? "ok $TNUM - works a 2nd time after intervening eval\n" : "not ok $TNUM - re-evaled version \n--Expected--\n$WANT\n--Got--\n$@$t\n"); } @@ -145,10 +161,10 @@ print "1..$TMAX\n"; ############# ############# -@c = ('c'); +my @c = ('c'); $c = \@c; -$b = {}; -$a = [1, $b, $c]; +$b = {}; # FIXME - use another variable name +$a = [1, $b, $c]; # FIXME - use another variable name $b->{a} = $a; $b->{b} = $a->[1]; $b->{c} = $a->[2]; @@ -284,7 +300,6 @@ if ($XS) { 'Indent: Seen: Dumpxs()'); } - ############# ## $WANT = <<'EOT'; @@ -383,8 +398,6 @@ $foo = { "abc\000\'\efg" => "mno\000", TEST (q(Data::Dumper::DumperX($foo)), 'Useqq: DumperX') if $XS; } - - ############# ############# @@ -872,12 +885,12 @@ TEST (q(Data::Dumper->new([$a,$b,$c],['a','b','c'])->Purity(1)->Dumpxs;), } { - $f = "pearl"; - $e = [ $f ]; + my $f = "pearl"; + my $e = [ $f ]; $d = { 'e' => $e }; $c = [ $d ]; - $b = { 'c' => $c }; - $a = { 'b' => $b }; + $b = { 'c' => $c }; # FIXME use different variable name + $a = { 'b' => $b }; # FIXME use different variable name ############# ## @@ -973,8 +986,8 @@ EOT } { - $i = 0; - $a = { map { ("$_$_$_", ++$i) } 'I'..'Q' }; + my $i = 0; + $a = { map { ("$_$_$_", ++$i) } 'I'..'Q' }; # FIXME use different variable name ############# ## @@ -1000,7 +1013,7 @@ TEST (q(Data::Dumper->new([$a])->Dumpxs;), } { - $i = 5; + my $i = 5; $c = { map { (++$i, "$_$_$_") } 'I'..'Q' }; local $Data::Dumper::Sortkeys = \&sort199; sub sort199 { @@ -1030,7 +1043,7 @@ TEST q(Data::Dumper->new([$c])->Dumpxs;), "sortkeys sub (XS)" } { - $i = 5; + my $i = 5; $c = { map { (++$i, "$_$_$_") } 'I'..'Q' }; $d = { reverse %$c }; local $Data::Dumper::Sortkeys = \&sort205; @@ -1087,6 +1100,7 @@ TEST q(Data::Dumper->new([[$c, $d]])->Dumpxs;), "more sortkeys sub (XS)" $WANT = <<'EOT'; #$VAR1 = { # foo => sub { +# use warnings; # print 'foo'; # } # }; @@ -1135,7 +1149,7 @@ EOT ); # The perl code always does things the same way for numbers. - $WANT_PL_N = <<'EOT'; + my $WANT_PL_N = <<'EOT'; #$VAR1 = 0; #$VAR2 = 1; #$VAR3 = -2; @@ -1157,7 +1171,7 @@ EOT EOT # The perl code knows that 0 and -2 stringify exactly back to the strings, # so it dumps them as numbers, not strings. - $WANT_PL_S = <<'EOT'; + my $WANT_PL_S = <<'EOT'; #$VAR1 = 0; #$VAR2 = '+1'; #$VAR3 = -2; @@ -1183,7 +1197,7 @@ EOT # (which makes IVs where possible) so values the tokeniser thought were # floating point are stored as NVs. The XS code outputs these as strings, # but as it has converted them from NVs, leading + signs will not be there. - $WANT_XS_N = <<'EOT'; + my $WANT_XS_N = <<'EOT'; #$VAR1 = 0; #$VAR2 = 1; #$VAR3 = -2; @@ -1206,7 +1220,7 @@ EOT # These are the strings as seen by the tokeniser. The XS code will output # these for all cases except where the scalar has been used in integer context - $WANT_XS_S = <<'EOT'; + my $WANT_XS_S = <<'EOT'; #$VAR1 = '0'; #$VAR2 = '+1'; #$VAR3 = '-2'; @@ -1231,7 +1245,7 @@ EOT # These will differ from WANT_XS_N because now IV flags will be set on all # values that were actually integer, and the XS code will then output these # as numbers not strings. - $WANT_XS_I = <<'EOT'; + my $WANT_XS_I = <<'EOT'; #$VAR1 = 0; #$VAR2 = 1; #$VAR3 = -2; @@ -1756,8 +1770,12 @@ EOT TEST (qq(Data::Dumper::DumperX("\n")), '\n alone') if $XS; } ############# -our @globs = map { $_, \$_ } map { *$_ } map { $_, "s::$_" } - "foo", "\1bar", "L\x{e9}on", "m\x{100}cron", "snow\x{2603}"; +{ + no strict 'refs'; + @globs = map { $_, \$_ } map { *$_ } map { $_, "s::$_" } + "foo", "\1bar", "L\x{e9}on", "m\x{100}cron", "snow\x{2603}"; +} + $WANT = change_glob_expectation(<<'EOT'); #$globs = [ # *::foo, @@ -1813,9 +1831,12 @@ $WANT = change_glob_expectation(<<'EOT'); EOT { *ppp = { a => 1 }; - *{"a/b"} = { b => 3 }; - *{"a\x{2603}b"} = { c => 5 }; - our $v = { a => \*ppp, b => \*{"a/b"}, c => \*{"a\x{2603}b"} }; + { + no strict 'refs'; + *{"a/b"} = { b => 3 }; + *{"a\x{2603}b"} = { c => 5 }; + $v = { a => \*ppp, b => \*{"a/b"}, c => \*{"a\x{2603}b"} }; + } local $Data::Dumper::Purity = 1; TEST (q(Data::Dumper->Dump([$v], ["v"])), 'glob purity: Dump()'); TEST (q(Data::Dumper->Dumpxs([$v], ["v"])), 'glob purity: Dumpxs()') if $XS; diff --git a/dist/Data-Dumper/t/dumpperl.t b/dist/Data-Dumper/t/dumpperl.t index 9220430ff9..9f939253f7 100644 --- a/dist/Data-Dumper/t/dumpperl.t +++ b/dist/Data-Dumper/t/dumpperl.t @@ -1,9 +1,13 @@ #!./perl -w # t/dumpperl.t - test all branches of, and modes of triggering, Dumpperl() + +use strict; +use warnings; + +use Config; + BEGIN { if ($ENV{PERL_CORE}){ - require Config; import Config; - no warnings 'once'; if ($Config{'extensions'} !~ /\bData\/Dumper\b/) { print "1..0 # Skip: Data::Dumper was not built\n"; exit 0; @@ -11,7 +15,6 @@ BEGIN { } } -use strict; use Carp; use Data::Dumper; use Test::More tests => 31; diff --git a/dist/Data-Dumper/t/freezer.t b/dist/Data-Dumper/t/freezer.t index 7f3b7ac8f8..981e41d15d 100644 --- a/dist/Data-Dumper/t/freezer.t +++ b/dist/Data-Dumper/t/freezer.t @@ -3,16 +3,18 @@ # test a few problems with the Freezer option, not a complete Freezer # test suite yet +use strict; +use warnings; + +use Config; + BEGIN { - require Config; import Config; - no warnings 'once'; if ($Config{'extensions'} !~ /\bData\/Dumper\b/) { print "1..0 # Skip: Data::Dumper was not built\n"; exit 0; } } -use strict; use Test::More tests => 8; use Data::Dumper; use lib qw( ./t/lib ); diff --git a/dist/Data-Dumper/t/freezer_useperl.t b/dist/Data-Dumper/t/freezer_useperl.t index b79c3c1edc..40031b48e9 100644 --- a/dist/Data-Dumper/t/freezer_useperl.t +++ b/dist/Data-Dumper/t/freezer_useperl.t @@ -3,16 +3,18 @@ # test a few problems with the Freezer option, not a complete Freezer # test suite yet +use strict; +use warnings; + +use Config; + BEGIN { - require Config; import Config; - no warnings 'once'; if ($Config{'extensions'} !~ /\bData\/Dumper\b/) { - print "1..0 # Skip: Data::Dumper was not built\n"; - exit 0; + print "1..0 # Skip: Data::Dumper was not built\n"; + exit 0; } } -use strict; use Test::More tests => 7; use Data::Dumper; use lib qw( ./t/lib ); diff --git a/dist/Data-Dumper/t/indent.t b/dist/Data-Dumper/t/indent.t index 2c9d8f967c..7a7203e85c 100644 --- a/dist/Data-Dumper/t/indent.t +++ b/dist/Data-Dumper/t/indent.t @@ -1,9 +1,13 @@ #!./perl -w # t/indent.t - Test Indent() + +use strict; +use warnings; + +use Config; + BEGIN { if ($ENV{PERL_CORE}){ - require Config; import Config; - no warnings 'once'; if ($Config{'extensions'} !~ /\bData\/Dumper\b/) { print "1..0 # Skip: Data::Dumper was not built\n"; exit 0; @@ -11,8 +15,6 @@ BEGIN { } } -use strict; - use Data::Dumper; use Test::More tests => 9; use lib qw( ./t/lib ); diff --git a/dist/Data-Dumper/t/misc.t b/dist/Data-Dumper/t/misc.t index 54a89e6dbc..ecf952fd62 100644 --- a/dist/Data-Dumper/t/misc.t +++ b/dist/Data-Dumper/t/misc.t @@ -1,10 +1,13 @@ #!./perl -w # t/misc.t - Test various functionality +use strict; +use warnings; + +use Config; + BEGIN { if ($ENV{PERL_CORE}){ - require Config; import Config; - no warnings 'once'; if ($Config{'extensions'} !~ /\bData\/Dumper\b/) { print "1..0 # Skip: Data::Dumper was not built\n"; exit 0; @@ -12,8 +15,6 @@ BEGIN { } } -use strict; - use Data::Dumper; use Test::More tests => 18; use lib qw( ./t/lib ); diff --git a/dist/Data-Dumper/t/names.t b/dist/Data-Dumper/t/names.t index 782f1cb768..f79db84c69 100644 --- a/dist/Data-Dumper/t/names.t +++ b/dist/Data-Dumper/t/names.t @@ -1,9 +1,12 @@ #!./perl -w +use strict; +use warnings; + +use Config; + BEGIN { if ($ENV{PERL_CORE}){ - require Config; import Config; - no warnings 'once'; if ($Config{'extensions'} !~ /\bData\/Dumper\b/) { print "1..0 # Skip: Data::Dumper was not built\n"; exit 0; @@ -11,7 +14,6 @@ BEGIN { } } -use strict; use Carp; use Data::Dumper; use Test::More tests => 15; diff --git a/dist/Data-Dumper/t/overload.t b/dist/Data-Dumper/t/overload.t index 3ccd2a91c3..0c40717f9f 100644 --- a/dist/Data-Dumper/t/overload.t +++ b/dist/Data-Dumper/t/overload.t @@ -1,9 +1,12 @@ #!./perl -w +use strict; +use warnings; + +use Config; + BEGIN { if ($ENV{PERL_CORE}){ - require Config; import Config; - no warnings 'once'; if ($Config{'extensions'} !~ /\bData\/Dumper\b/) { print "1..0 # Skip: Data::Dumper was not built\n"; exit 0; @@ -11,7 +14,6 @@ BEGIN { } } -use strict; use Data::Dumper; use Test::More tests => 4; diff --git a/dist/Data-Dumper/t/pair.t b/dist/Data-Dumper/t/pair.t index c7eafe472e..2a68f9fece 100644 --- a/dist/Data-Dumper/t/pair.t +++ b/dist/Data-Dumper/t/pair.t @@ -3,10 +3,13 @@ # test for $Data::Dumper::Pair AKA Data::Dumper->new([ ... ])->Pair('...') # +use strict; +use warnings; + +use Config; + BEGIN { if ($ENV{PERL_CORE}){ - require Config; import Config; - no warnings 'once'; if ($Config{'extensions'} !~ /\bData\/Dumper\b/) { print "1..0 # Skip: Data::Dumper was not built\n"; exit 0; @@ -14,7 +17,6 @@ BEGIN { } } -use strict; our ($want_colon, $want_comma); use Test::More tests => 9; diff --git a/dist/Data-Dumper/t/perl-74170.t b/dist/Data-Dumper/t/perl-74170.t index cca94aeb48..3a04f3723a 100644 --- a/dist/Data-Dumper/t/perl-74170.t +++ b/dist/Data-Dumper/t/perl-74170.t @@ -3,17 +3,20 @@ # Regression test for [perl #74170] (missing SPAGAIN after DD_Dump(...)): # Since it’s so large, it gets its own file. +use strict; +use warnings; + +use Config; + BEGIN { if ($ENV{PERL_CORE}){ - require Config; import Config; - no warnings 'once'; if ($Config{'extensions'} !~ /\bData\/Dumper\b/) { print "1..0 # Skip: Data::Dumper was not built\n"; exit 0; } } } -use strict; + use Test::More tests => 1; use Data::Dumper; diff --git a/dist/Data-Dumper/t/purity_deepcopy_maxdepth.t b/dist/Data-Dumper/t/purity_deepcopy_maxdepth.t index 3a7dc49b19..30a42e235e 100644 --- a/dist/Data-Dumper/t/purity_deepcopy_maxdepth.t +++ b/dist/Data-Dumper/t/purity_deepcopy_maxdepth.t @@ -2,10 +2,13 @@ # t/purity_deepcopy_maxdepth.t - Test Purity(), Deepcopy(), # Maxdepth() and recursive structures +use strict; +use warnings; + +use Config; + BEGIN { if ($ENV{PERL_CORE}){ - require Config; import Config; - no warnings 'once'; if ($Config{'extensions'} !~ /\bData\/Dumper\b/) { print "1..0 # Skip: Data::Dumper was not built\n"; exit 0; @@ -13,8 +16,6 @@ BEGIN { } } -use strict; - use Data::Dumper; use Test::More tests => 22; use lib qw( ./t/lib ); diff --git a/dist/Data-Dumper/t/qr.t b/dist/Data-Dumper/t/qr.t index 43a3c19b98..30aef4792a 100644 --- a/dist/Data-Dumper/t/qr.t +++ b/dist/Data-Dumper/t/qr.t @@ -1,11 +1,14 @@ #!perl -X +use strict; +use warnings; + +use Config; + BEGIN { - require Config; import Config; - no warnings 'once'; if ($Config{'extensions'} !~ /\bData\/Dumper\b/) { - print "1..0 # Skip: Data::Dumper was not built\n"; - exit 0; + print "1..0 # Skip: Data::Dumper was not built\n"; + exit 0; } } @@ -16,9 +19,15 @@ use Data::Dumper; my $q = q| \/ |; use Data::Dumper; my $qr = qr{$q}; - eval Dumper $qr; + eval add_my_to_dump( Dumper $qr ); ok(!$@, "Dumping $qr with XS") or diag $@, Dumper $qr; local $Data::Dumper::Useperl = 1; - eval Dumper $qr; + eval add_my_to_dump( Dumper $qr ); ok(!$@, "Dumping $qr with PP") or diag $@, Dumper $qr; } + +sub add_my_to_dump { + $_[0] =~ s{^(\s*)(\$VAR)}{$1 my $2}mg; + + return $_[0]; +} diff --git a/dist/Data-Dumper/t/quotekeys.t b/dist/Data-Dumper/t/quotekeys.t index 076cdf6f8a..3a27c54d78 100644 --- a/dist/Data-Dumper/t/quotekeys.t +++ b/dist/Data-Dumper/t/quotekeys.t @@ -1,10 +1,13 @@ #!./perl -w # t/quotekeys.t - Test Quotekeys() +use strict; +use warnings; + +use Config; + BEGIN { if ($ENV{PERL_CORE}){ - require Config; import Config; - no warnings 'once'; if ($Config{'extensions'} !~ /\bData\/Dumper\b/) { print "1..0 # Skip: Data::Dumper was not built\n"; exit 0; @@ -12,8 +15,6 @@ BEGIN { } } -use strict; - use Data::Dumper; use Test::More tests => 18; use lib qw( ./t/lib ); diff --git a/dist/Data-Dumper/t/recurse.t b/dist/Data-Dumper/t/recurse.t index 275a89d236..7b9c64ffdf 100644 --- a/dist/Data-Dumper/t/recurse.t +++ b/dist/Data-Dumper/t/recurse.t @@ -3,6 +3,8 @@ # Test the Maxrecurse option use strict; +use warnings; + use Test::More tests => 32; use Data::Dumper; diff --git a/dist/Data-Dumper/t/seen.t b/dist/Data-Dumper/t/seen.t index 08e4f1e381..ebe12867dd 100644 --- a/dist/Data-Dumper/t/seen.t +++ b/dist/Data-Dumper/t/seen.t @@ -1,10 +1,13 @@ #!./perl -w # t/seen.t - Test Seen() +use strict; +use warnings; + +use Config; + BEGIN { if ($ENV{PERL_CORE}){ - require Config; import Config; - no warnings 'once'; if ($Config{'extensions'} !~ /\bData\/Dumper\b/) { print "1..0 # Skip: Data::Dumper was not built\n"; exit 0; @@ -12,8 +15,6 @@ BEGIN { } } -use strict; - use Data::Dumper; use Test::More tests => 10; use lib qw( ./t/lib ); diff --git a/dist/Data-Dumper/t/sortkeys.t b/dist/Data-Dumper/t/sortkeys.t index fbd8197b11..a91e161ce3 100644 --- a/dist/Data-Dumper/t/sortkeys.t +++ b/dist/Data-Dumper/t/sortkeys.t @@ -1,10 +1,13 @@ #!./perl -w # t/sortkeys.t - Test Sortkeys() +use strict; +use warnings; + +use Config; + BEGIN { if ($ENV{PERL_CORE}){ - require Config; import Config; - no warnings 'once'; if ($Config{'extensions'} !~ /\bData\/Dumper\b/) { print "1..0 # Skip: Data::Dumper was not built\n"; exit 0; @@ -12,8 +15,6 @@ BEGIN { } } -use strict; - use Data::Dumper; use Test::More tests => 26; use lib qw( ./t/lib ); diff --git a/dist/Data-Dumper/t/sparseseen.t b/dist/Data-Dumper/t/sparseseen.t index c78dec67ce..12525ddf3a 100644 --- a/dist/Data-Dumper/t/sparseseen.t +++ b/dist/Data-Dumper/t/sparseseen.t @@ -1,10 +1,13 @@ #!./perl -w # t/sparseseen.t - Test Sparseseen() +use strict; +use warnings; + +use Config; + BEGIN { if ($ENV{PERL_CORE}){ - require Config; import Config; - no warnings 'once'; if ($Config{'extensions'} !~ /\bData\/Dumper\b/) { print "1..0 # Skip: Data::Dumper was not built\n"; exit 0; @@ -12,8 +15,6 @@ BEGIN { } } -use strict; - use Data::Dumper; use Test::More tests => 8; use lib qw( ./t/lib ); diff --git a/dist/Data-Dumper/t/terse.t b/dist/Data-Dumper/t/terse.t index a815c365d5..53b80b49b7 100644 --- a/dist/Data-Dumper/t/terse.t +++ b/dist/Data-Dumper/t/terse.t @@ -1,4 +1,5 @@ #!perl + use strict; use warnings; diff --git a/dist/Data-Dumper/t/toaster.t b/dist/Data-Dumper/t/toaster.t index 6e7d0e0306..abb7eca073 100644 --- a/dist/Data-Dumper/t/toaster.t +++ b/dist/Data-Dumper/t/toaster.t @@ -1,10 +1,13 @@ #!./perl -w # t/toaster.t - Test Toaster() +use strict; +use warnings; + +use Config; + BEGIN { if ($ENV{PERL_CORE}){ - require Config; import Config; - no warnings 'once'; if ($Config{'extensions'} !~ /\bData\/Dumper\b/) { print "1..0 # Skip: Data::Dumper was not built\n"; exit 0; @@ -12,8 +15,6 @@ BEGIN { } } -use strict; - use Data::Dumper; use Test::More tests => 8; use lib qw( ./t/lib ); diff --git a/dist/Data-Dumper/t/trailing_comma.t b/dist/Data-Dumper/t/trailing_comma.t index 8767bdfd2b..409ec9ff2f 100644 --- a/dist/Data-Dumper/t/trailing_comma.t +++ b/dist/Data-Dumper/t/trailing_comma.t @@ -1,10 +1,13 @@ #!./perl -w # t/trailing_comma.t - Test TrailingComma() +use strict; +use warnings; + +use Config; + BEGIN { if ($ENV{PERL_CORE}){ - require Config; import Config; - no warnings 'once'; if ($Config{'extensions'} !~ /\bData\/Dumper\b/) { print "1..0 # Skip: Data::Dumper was not built\n"; exit 0; @@ -12,8 +15,6 @@ BEGIN { } } -use strict; - use Data::Dumper; use Test::More; use lib qw( ./t/lib ); diff --git a/dist/Data-Dumper/t/values.t b/dist/Data-Dumper/t/values.t index 444ebc3db4..22f28af843 100644 --- a/dist/Data-Dumper/t/values.t +++ b/dist/Data-Dumper/t/values.t @@ -1,9 +1,12 @@ #!./perl -w +use strict; +use warnings; + +use Config; + BEGIN { if ($ENV{PERL_CORE}){ - require Config; import Config; - no warnings 'once'; if ($Config{'extensions'} !~ /\bData\/Dumper\b/) { print "1..0 # Skip: Data::Dumper was not built\n"; exit 0; @@ -11,7 +14,6 @@ BEGIN { } } -use strict; use Data::Dumper; use Test::More tests => 4; |