From: Aristotle Pagaltzis Date: Sun, 29 Mar 2015 15:20:07 +0000 (+0200) Subject: test Sub::Name for exotic sub names X-Git-Tag: v0.16~6^2~4 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=4d96bce5adb7539822606e40fa8aa2f4fbc23fc8;p=p5sagit%2FSub-Name.git test Sub::Name for exotic sub names Reveals incorrect handling of - ' (\x27) on all perls - \0 on perl > 5.14 - Unicode on perl > 5.16 --- diff --git a/t/exotic_names.t b/t/exotic_names.t index 00a8b46..ca00f5f 100644 --- a/t/exotic_names.t +++ b/t/exotic_names.t @@ -50,6 +50,8 @@ sub caller3_ok { ####################################################################### +use Sub::Name 'subname'; + my @ordinal = ( 1 .. 255 ); # 5.14 is the first perl to start properly handling \0 in identifiers @@ -64,7 +66,7 @@ push @ordinal, 0x1f4a9, # PILE OF POO unless $] < 5.008; -plan tests => @ordinal * 2; +plan tests => @ordinal * 2 * 2; my $legal_ident_char = "A-Z_a-z0-9'"; $legal_ident_char .= join '', map chr, 0x100, 0x498 @@ -76,6 +78,9 @@ for my $ord (@ordinal) { my $subname = sprintf 'SOME_%c_NAME', $ord; my $fullname = join '::', $pkg, $subname; + $sub = subname $fullname => sub { (caller(0))[3] }; + caller3_ok $sub, $fullname, 'renamed closure', $ord; + # test that we can *always* compile at least within the correct package my $expected; if ( chr($ord) =~ m/^[$legal_ident_char]$/o ) { # compile directly