This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
add OPpCONCAT_NESTED flag
[perl5.git] / lib / B / Deparse-subclass.t
CommitLineData
8db6f480
FC
1#!./perl
2
3# These tests are not necessarily normative, but until such time as we
4# publicise an API for subclassing B::Deparse they can prevent us from
5# gratuitously breaking conventions that CPAN modules already use.
6
c9fa6ae9 7use Test::More tests => 2;
8db6f480
FC
8
9use B::Deparse;
10
11package B::Deparse::NameMangler {
12 @ISA = "B::Deparse";
13 sub padname { SUPER::padname{@_} . '_groovy' }
14}
15
c9fa6ae9
FC
16my $nm = 'B::Deparse::NameMangler'->new;
17
18like $nm->coderef2text(sub { my($a, $b, $c) }),
8db6f480
FC
19 qr/\$a_groovy, \$b_groovy, \$c_groovy/,
20 'overriding padname works for renaming lexicals';
c9fa6ae9 21
c9fa6ae9
FC
22like $nm->coderef2text(sub { my $c; /(??{ $c })/; }),
23 qr/\Q(??{\E \$c_groovy/,
24 'overriding padname works for renaming lexicals in regexp blocks';