6 if (($Config::Config{'extensions'} !~ /\bB\b/) ){
7 print "1..0 # Skip -- Perl configured without B module\n";
21 my $verbose = @ARGV; # set if ANY ARGS
25 my $path = join " ", map { qq["-I$_"] } @INC;
26 my $is_thread = $Config{use5005threads} && $Config{use5005threads} eq 'define';
29 ok "# use5005threads: test skipped\n";
31 $a = `$^X $path "-MO=Showlex" -e "my \@one" 2>&1`;
32 like ($a, qr/undef.*: \([^)]*\) \@one.*Nullsv.*AV/s,
33 "canonical usage works");
38 my ($na,$nb,$nc); # holds regex-strs
39 my ($out, $newlex); # output, option-flag
42 my ($varname,$newlex) = @_;
44 ? '\(0x[0-9a-fA-F]+\) "\\'.$varname.'" = '
45 : "\\\(0x[0-9a-fA-F]+\\\) \\$varname\n";
48 for $newlex ('', '-newlex') {
50 $out = runperl ( switches => ["-MO=Showlex,$newlex"],
51 prog => 'my ($a,$b)', stderr => 1 );
52 $na = padrep('$a',$newlex);
53 $nb = padrep('$b',$newlex);
54 like ($out, qr/1: $na/ms, 'found $a in "my ($a,$b)"');
55 like ($out, qr/2: $nb/ms, 'found $b in "my ($a,$b)"');
57 print $out if $verbose;
60 skip "no perlio in this build", 5
61 unless $Config::Config{useperlio};
63 our $buf = 'arb startval';
64 my $ak = B::Showlex::walk_output (\$buf);
66 my $walker = B::Showlex::compile( $newlex, sub{my($foo,$bar)} );
68 $na = padrep('$foo',$newlex);
69 $nb = padrep('$bar',$newlex);
70 like ($buf, qr/1: $na/ms, 'found $foo in "sub { my ($foo,$bar) }"');
71 like ($buf, qr/2: $nb/ms, 'found $bar in "sub { my ($foo,$bar) }"');
73 print $buf if $verbose;
75 $ak = B::Showlex::walk_output (\$buf);
77 my $src = 'sub { my ($scalar,@arr,%hash) }';
79 $walker = B::Showlex::compile($sub);
81 $na = padrep('$scalar',$newlex);
82 $nb = padrep('@arr',$newlex);
83 $nc = padrep('%hash',$newlex);
84 like ($buf, qr/1: $na/ms, 'found $scalar in "'. $src .'"');
85 like ($buf, qr/2: $nb/ms, 'found @arr in "'. $src .'"');
86 like ($buf, qr/3: $nc/ms, 'found %hash in "'. $src .'"');
88 print $buf if $verbose;
90 # fibonacci function under test
96 for (my $i=2; $i<10; $i++) {
97 $fib[$i] = $fib[$i-2] + $fib[$i-1];
104 $walker = B::Showlex::compile($asub, $newlex, -nosp);
106 print $buf if $verbose;
108 $walker = B::Concise::compile($asub, '-exec');