Skip to content

Commit

Permalink
Storable: add test names to t/utf8.t
Browse files Browse the repository at this point in the history
  • Loading branch information
tonycoz committed Jul 11, 2024
1 parent 336a5a0 commit d44f24a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
4 changes: 4 additions & 0 deletions dist/Storable/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
Release history for Storable

3.33 - 2024-07-11 00:41:35

- add some test names to t/utf8.t

3.32 - 2023-05-26 21:36:00 demerphq

- Update security advisory to be more clear
Expand Down
2 changes: 1 addition & 1 deletion dist/Storable/Storable.pm
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ our @EXPORT_OK = qw(
our ($canonical, $forgive_me);

BEGIN {
our $VERSION = '3.32';
our $VERSION = '3.33';
}

our $recursion_limit;
Expand Down
12 changes: 6 additions & 6 deletions dist/Storable/t/utf8.t
Original file line number Diff line number Diff line change
Expand Up @@ -22,32 +22,32 @@ use Storable qw(thaw freeze);
use Test::More tests => 6;

my $x = chr(1234);
is($x, ${thaw freeze \$x});
is($x, ${thaw freeze \$x}, "round trip one unicode character");

# Long scalar
$x = join '', map {chr $_} (0..1023);
is($x, ${thaw freeze \$x});
is($x, ${thaw freeze \$x}, "round trip Unicode string");

# Char in the range 127-255 (probably) in utf8. This just won't work for
# EBCDIC for early Perls.
$x = ($] lt 5.007_003) ? chr(175) : chr(utf8::unicode_to_native(175))
. chr (256);
chop $x;
is($x, ${thaw freeze \$x});
is($x, ${thaw freeze \$x}, "round strip a 128-255 character");

# Storable needs to cope if a frozen string happens to be internal utf8
# encoded

$x = chr 256;
my $data = freeze \$x;
is($x, ${thaw $data});
is($x, ${thaw $data}, "sanity check for upgraded frozen data");

$data .= chr 256;
chop $data;
is($x, ${thaw $data});
is($x, ${thaw $data}, "test for upgraded frozen data");


$data .= chr 256;
# This definitely isn't valid
eval {thaw $data};
like($@, qr/corrupt.*characters outside/);
like($@, qr/corrupt.*characters outside/, "check error handling for added 256 code point");

0 comments on commit d44f24a

Please sign in to comment.