6 @INC = qw(: ::lib ::macos:lib);
21 my $verbose = @ARGV; # set if ANY ARGS
24 my $Is_VMS = $^O eq 'VMS';
25 my $Is_MacOS = $^O eq 'MacOS';
27 my $path = join " ", map { qq["-I$_"] } @INC;
28 $path = '"-I../lib" "-Iperl_root:[lib]"' if $Is_VMS; # gets too long otherwise
29 my $redir = $Is_MacOS ? "" : "2>&1";
30 my $is_thread = $Config{use5005threads} && $Config{use5005threads} eq 'define';
33 ok "# use5005threads: test skipped\n";
35 $a = `$^X $path "-MO=Showlex" -e "my \@one" $redir`;
36 like ($a, qr/sv_undef.*PVNV.*\@one.*sv_undef.*AV/s,
37 "canonical usage works");
42 my ($na,$nb,$nc); # holds regex-strs
45 return "PVNV \\\(0x[0-9a-fA-F]+\\\) \\$varname\n";
48 my $out = runperl ( switches => ["-MO=Showlex"],
49 prog => 'my ($a,$b)', stderr => 1 );
52 like ($out, qr/1: $na/ms, 'found $a in "my ($a,$b)"');
53 like ($out, qr/2: $nb/ms, 'found $b in "my ($a,$b)"');
55 print $out if $verbose;
57 our $buf = 'arb startval';
58 my $ak = B::Showlex::walk_output (\$buf);
60 my $walker = B::Showlex::compile(sub { my ($foo,$bar) });
64 like ($buf, qr/1: $na/ms, 'found $foo in "sub { my ($foo,$bar) }"');
65 like ($buf, qr/2: $nb/ms, 'found $bar in "sub { my ($foo,$bar) }"');
67 print $buf if $verbose;
69 $ak = B::Showlex::walk_output (\$buf);
71 $walker = B::Showlex::compile(sub { my ($scalar,@arr,%hash) });
73 $na = padrep('$scalar');
75 $nc = padrep('%hash');
76 like ($buf, qr/1: $na/ms, 'found $scalar in "sub { my ($scalar,@arr,%hash) }"');
77 like ($buf, qr/2: $nb/ms, 'found @arr in "sub { my ($scalar,@arr,%hash) }"');
78 like ($buf, qr/3: $nc/ms, 'found %hash in "sub { my ($scalar,@arr,%hash) }"');
80 print $buf if $verbose;
87 for (my $i=2; $i<10; $i++) {
88 $fib[$i] = $fib[$i-2] + $fib[$i-1];
95 $walker = B::Showlex::compile($asub, '-newlex');
98 $walker = B::Concise::compile($asub, '-exec');
102 print $buf if $verbose;