diff options
Diffstat (limited to 'lib/B/Deparse.t')
-rw-r--r-- | lib/B/Deparse.t | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/lib/B/Deparse.t b/lib/B/Deparse.t index d1c9f6c30e..01954759e8 100644 --- a/lib/B/Deparse.t +++ b/lib/B/Deparse.t @@ -13,7 +13,7 @@ BEGIN { use warnings; use strict; -my $tests = 45; # not counting those in the __DATA__ section +my $tests = 46; # not counting those in the __DATA__ section use B::Deparse; my $deparse = B::Deparse->new(); @@ -501,6 +501,12 @@ like runperl(stderr => 1, switches => [ '-MO=-qq,Deparse', $path ], qr/^sub foo \{\s+foo\(\)/m, 'recursive sub'; +like runperl(stderr => 1, switches => [ '-MO=-qq,Deparse', $path ], + prog => 'use feature lexical_subs=>state=>; + state sub sb5; sub { sub sb5 { } }'), + qr/sub \{\s*\(\);\s*sub sb5 {/m, + 'state sub in anon sub but declared outside'; + is runperl(stderr => 1, switches => [ '-MO=-qq,Deparse', $path ], prog => 'BEGIN { $::{f}=\!0 }'), "sub BEGIN {\n \$main::{'f'} = \\1;\n}\n", @@ -1925,6 +1931,21 @@ my sub g { sub f { } } #### +# TODO only partially fixed +# lexical state subroutine with outer declaration and inner definition +# CONTEXT use feature 'lexical_subs', 'state'; no warnings 'experimental::lexical_subs'; +(); +state sub sb4; +state sub a { + (); + sub sb4 { } +} +state sub sb5; +sub { + (); + sub sb5 { } +} ; +#### # Elements of %# should not be confused with $#{ array } () = ${#}{'foo'}; #### |