diff -bu Sub-Name-0.21-34/t/exotic_names.t~ Sub-Name-0.21-34/t/exotic_names.t --- Sub-Name-0.21-34/t/exotic_names.t~ 2016-10-02 07:00:17.000000000 +0200 +++ Sub-Name-0.21-34/t/exotic_names.t 2017-02-18 11:47:26.000000000 +0100 @@ -3,6 +3,8 @@ use Test::More; use B 'svref_2object'; +use Config (); +my $CPERL = $Config::Config{usecperl}; # This is a mess. The stash can supposedly handle Unicode but the behavior # is literally undefined before 5.16 (with crashes beyond the basic plane), @@ -48,6 +50,10 @@ # this is apparently how things worked before 5.16 utf8::encode($expected) if "$]" < 5.016 and $ord > 255; + # before 5.16 and after v5.25.2c names with NUL are stripped + if (!$ord and ($] < 5.016 or ($CPERL and $] >= 5.025002))) { + $expected =~ s/\0.*//; + } my $stash_name = join '::', map { $_->STASH->NAME, $_->NAME } svref_2object($sub)->GV; @@ -61,9 +67,9 @@ my @ordinal = ( 1 .. 255 ); -# 5.14 is the first perl to start properly handling \0 in identifiers -unshift @ordinal, 0 - unless "$]" < 5.014; +# 5.16 is the first perl to allow \0 in identifiers +# 5.25.2c disallowed \0 again. +unshift @ordinal, 0 if $] >= 5.016 and !($] >= 5.025002 and $CPERL); # Unicode in 5.6 is not sane (crashes etc) push @ordinal, @@ -84,6 +90,12 @@ my $pkg = sprintf 'test::SOME_%c_STASH', $ord; my $subname = sprintf 'SOME_%c_NAME', $ord; my $fullname = join '::', $pkg, $subname; + if ($ord == 0x27) { # ' => :: gv.c:S_parse_gv_stash_name + $fullname = "test::SOME_::_STASH::SOME_::_NAME"; + } + if (!$ord && ($] >= 5.025002 and $CPERL)) { + $fullname = "test::SOME_::SOME_"; + } $sub = subname $fullname => sub { (caller(0))[3] }; caller3_ok $sub, $fullname, 'renamed closure', $ord;