diff options
author | Nicholas Clark <nick@ccl4.org> | 2021-05-24 19:29:24 +0000 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2021-08-30 07:40:21 +0000 |
commit | a86a81d3b9752ed84fa565382477cecf2a468406 (patch) | |
tree | 06c12cfc17ead2bc31b17150e21e61b6adcaed3d /dist | |
parent | c4651bb069093655fae90cd51f80372e68e3fa0f (diff) | |
download | perl-a86a81d3b9752ed84fa565382477cecf2a468406.tar.gz |
Remove code in Storable's tests that handles perl < v5.6.1
Diffstat (limited to 'dist')
-rw-r--r-- | dist/Storable/t/downgrade.t | 56 | ||||
-rw-r--r-- | dist/Storable/t/freeze.t | 1 | ||||
-rw-r--r-- | dist/Storable/t/integer.t | 5 | ||||
-rw-r--r-- | dist/Storable/t/make_downgrade.pl | 5 | ||||
-rw-r--r-- | dist/Storable/t/restrict.t | 7 | ||||
-rw-r--r-- | dist/Storable/t/utf8.t | 4 |
6 files changed, 10 insertions, 68 deletions
diff --git a/dist/Storable/t/downgrade.t b/dist/Storable/t/downgrade.t index 617fb59ad4..43a32eda39 100644 --- a/dist/Storable/t/downgrade.t +++ b/dist/Storable/t/downgrade.t @@ -50,10 +50,8 @@ if ($] > 5.007002) { my $a_circumflex = (ord ('A') == 193 ? "\x47" : "\xe5"); %U_HASH = (map {$_, $_} 'castle', "ch${a_circumflex}teau", $utf8, chr 0x57CE); plan tests => 169; -} elsif ($] >= 5.006) { - plan tests => 59; } else { - plan tests => 67; + plan tests => 59; } $UTF8_CROAK = "/^Cannot retrieve UTF8 data in non-UTF8 perl/"; @@ -91,17 +89,7 @@ sub thaw_scalar { my $scalar = eval {thaw $tests{$name}}; is ($@, '', "Thawed $name without error?"); isa_ok ($scalar, 'SCALAR', "Thawed $name?"); - if ($bug and $] == 5.006) { - # Aargh. <expletive> <expletive> 5.6.0's harness doesn't even honour - # TODO tests. - warn "# Test skipped because eq is buggy for certain Unicode cases in 5.6.0"; - warn "# Please upgrade to 5.6.1\n"; - ok ("I'd really like to fail this test on 5.6.0 but I'm told that CPAN auto-dependencies mess up, and certain vendors only ship 5.6.0. Get your vendor to ugrade. Else upgrade your vendor."); - # One such vendor being the folks who brought you LONG_MIN as a positive - # integer. - } else { - is ($$scalar, $expected, "And it is the data we expected?"); - } + is ($$scalar, $expected, "And it is the data we expected?"); $scalar; } @@ -189,26 +177,11 @@ if (eval "use Hash::Util; 1") { thaw_fail ('Locked keys placeholder', $RESTRICTED_CROAK); } -if ($] >= 5.006) { - print "# We have utf8 scalars, so test that the utf8 scalars in <DATA> are valid\n"; - thaw_scalar ('Short 8 bit utf8 data', "\xDF", 1); - thaw_scalar ('Long 8 bit utf8 data', "\xDF" x 256, 1); - thaw_scalar ('Short 24 bit utf8 data', chr 0xC0FFEE); - thaw_scalar ('Long 24 bit utf8 data', chr (0xC0FFEE) x 256); -} else { - print "# We don't have utf8 scalars, so test that the utf8 scalars downgrade\n"; - thaw_fail ('Short 8 bit utf8 data', $UTF8_CROAK); - thaw_fail ('Long 8 bit utf8 data', $UTF8_CROAK); - thaw_fail ('Short 24 bit utf8 data', $UTF8_CROAK); - thaw_fail ('Long 24 bit utf8 data', $UTF8_CROAK); - local $Storable::drop_utf8 = 1; - my $bytes = thaw $tests{'Short 8 bit utf8 data as bytes'}; - thaw_scalar ('Short 8 bit utf8 data', $$bytes); - thaw_scalar ('Long 8 bit utf8 data', $$bytes x 256); - $bytes = thaw $tests{'Short 24 bit utf8 data as bytes'}; - thaw_scalar ('Short 24 bit utf8 data', $$bytes); - thaw_scalar ('Long 24 bit utf8 data', $$bytes x 256); -} +print "# We have utf8 scalars, so test that the utf8 scalars in <DATA> are valid\n"; +thaw_scalar ('Short 8 bit utf8 data', "\xDF", 1); +thaw_scalar ('Long 8 bit utf8 data', "\xDF" x 256, 1); +thaw_scalar ('Short 24 bit utf8 data', chr 0xC0FFEE); +thaw_scalar ('Long 24 bit utf8 data', chr (0xC0FFEE) x 256); if ($] > 5.007002) { print "# We have utf8 hashes, so test that the utf8 hashes in <DATA> are valid\n"; @@ -240,8 +213,7 @@ if ($] > 5.007002) { thaw_fail ('Hash with utf8 keys', $UTF8_CROAK); thaw_fail ('Locked hash with utf8 keys', $UTF8_CROAK); local $Storable::drop_utf8 = 1; - my $what = $] < 5.006 ? 'pre 5.6' : '5.6'; - my $expect = thaw $tests{"Hash with utf8 keys for $what"}; + my $expect = thaw $tests{"Hash with utf8 keys for 5.6"}; thaw_hash ('Hash with utf8 keys', $expect); #foreach (keys %$expect) { print "'$_':\t'$expect->{$_}'\n"; } #foreach (keys %$got) { print "'$_':\t'$got->{$_}'\n"; } @@ -370,12 +342,6 @@ D96%U%P/EGXX%`````^6?CA<'4V-H;&_#GP8````&4V-H;&_? end -begin 101 Hash with utf8 keys for pre 5.6 -M!049``````0*!F-A<W1L90`````&8V%S=&QE"@=C:.5T96%U``````=C:.5T -D96%U"@/EGXX``````^6?C@H'4V-H;&_#GP(````&4V-H;&_? - -end - begin 101 Hash with utf8 keys for 5.6 M!049``````0*!F-A<W1L90`````&8V%S=&QE"@=C:.5T96%U``````=C:.5T D96%U%P/EGXX``````^6?CA<'4V-H;&_#GP(````&4V-H;&_? @@ -494,12 +460,6 @@ FHY.%%P3<9')5!0````3<9')5%P?B@XB3EHMS!@````;B@XB3EM\` end -begin 301 Hash with utf8 keys for pre 5.6 -M!049``````0*!H.!HJ.3A0`````&@X&BHY.%"@B#B(M&HX6!I``````'@XA' -GHX6!I`H'XH.(DY:+<P(````&XH.(DY;?"@3<9')5``````3<9')5 - -end - begin 301 Hash with utf8 keys for 5.6 M!049``````0*!H.!HJ.3A0`````&@X&BHY.%"@>#B$>CA8&D``````>#B$>C FA8&D%P?B@XB3EHMS`@````;B@XB3EM\7!-QD<E4`````!-QD<E4` diff --git a/dist/Storable/t/freeze.t b/dist/Storable/t/freeze.t index d254c6f560..1dbac0c037 100644 --- a/dist/Storable/t/freeze.t +++ b/dist/Storable/t/freeze.t @@ -125,7 +125,6 @@ thaw $frozen; # used to segfault here pass("Didn't segfault"); SKIP: { - skip 'no av_exists', 2 unless $] >= 5.006; my (@a, @b); eval ' $a = []; $#$a = 2; $a->[1] = undef; diff --git a/dist/Storable/t/integer.t b/dist/Storable/t/integer.t index b17f3928c0..b6d9f90f03 100644 --- a/dist/Storable/t/integer.t +++ b/dist/Storable/t/integer.t @@ -156,11 +156,6 @@ foreach (@processes) { die "Was supposed to have number $copy_s3, got error $@" unless defined $copy_s3; my $bit = ok (($copy_s3 ^ $copy1) == 0, "$process $copy1 (bitpattern)"); - # This is sick. 5.005_03 survives without the IV/UV flag, and somehow - # gets it right, providing you don't have side effects of conversion. -# local $TODO; -# $TODO = "pre 5.6 doesn't have flag to distinguish IV/UV" -# if $] < 5.005_56 and $copy1 > $max_iv; my $sign = ok (($copy_s2 <=> 0) == ($copy2 <=> 0), "$process $copy1 (sign)"); diff --git a/dist/Storable/t/make_downgrade.pl b/dist/Storable/t/make_downgrade.pl index fc801a4953..60375db0c2 100644 --- a/dist/Storable/t/make_downgrade.pl +++ b/dist/Storable/t/make_downgrade.pl @@ -90,7 +90,7 @@ lock_hash %uhash; uuencode_it (\%uhash, "Locked hash with utf8 keys"); -my (%pre56, %pre58); +my %pre58; while (my ($key, $val) = each %uhash) { # hash keys are always stored downgraded to bytes if possible, with a flag @@ -98,9 +98,6 @@ while (my ($key, $val) = each %uhash) { # Whereas scalars are stored as is. utf8::encode ($key) if ord $key > 256; $pre58{$key} = $val; - utf8::encode ($val) unless $val eq "ch\xe5teau"; - $pre56{$key} = $val; } -uuencode_it (\%pre56, "Hash with utf8 keys for pre 5.6"); uuencode_it (\%pre58, "Hash with utf8 keys for 5.6"); diff --git a/dist/Storable/t/restrict.t b/dist/Storable/t/restrict.t index 41f7aad14c..36a9179338 100644 --- a/dist/Storable/t/restrict.t +++ b/dist/Storable/t/restrict.t @@ -16,12 +16,7 @@ sub BEGIN { exit 0; } } else { - if ($] < 5.005) { - print "1..0 # Skip: No Hash::Util pre 5.005\n"; - exit 0; - # And doing this seems on 5.004 seems to create bogus warnings about - # uninitialized variables, or coredumps in Perl_pp_padsv - } elsif (!eval "require Hash::Util") { + if (!eval "require Hash::Util") { if ($@ =~ /Can\'t locate Hash\/Util\.pm in \@INC/s) { print "1..0 # Skip: No Hash::Util:\n"; exit 0; diff --git a/dist/Storable/t/utf8.t b/dist/Storable/t/utf8.t index a8dd6cd317..0f546f0376 100644 --- a/dist/Storable/t/utf8.t +++ b/dist/Storable/t/utf8.t @@ -7,10 +7,6 @@ # sub BEGIN { - if ($] < 5.006) { - print "1..0 # Skip: no utf8 support\n"; - exit 0; - } unshift @INC, 't'; unshift @INC, 't/compat' if $] < 5.006002; require Config; import Config; |