1322235699df1e16dec71583fb91ec6703064dbf
[p5sagit/p5-mst-13.2.git] / ext / B / t / showlex.t
1 #!./perl
2
3 BEGIN {
4     chdir 't' if -d 't';
5     if ($^O eq 'MacOS') {
6         @INC = qw(: ::lib ::macos:lib);
7     } else {
8         @INC = '../lib';
9     }
10 }
11
12 $|  = 1;
13 use warnings;
14 use strict;
15 use Config;
16
17 print "1..1\n";
18
19 my $test = 1;
20
21 sub ok { print "ok $test\n"; $test++ }
22
23 my $a;
24 my $Is_VMS = $^O eq 'VMS';
25 my $Is_MacOS = $^O eq 'MacOS';
26
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';
31
32 if ($is_thread) {
33     print "# use5005threads: test $test skipped\n";
34 } else {
35     $a = `$^X $path "-MO=Showlex" -e "my \@one" $redir`;
36     if (ord('A') != 193) { # ASCIIish
37         print "# [$a]\nnot " unless $a =~ /sv_undef.*PVNV.*\@one.*sv_undef.*AV/s;
38     }
39     else { # EBCDICish C<1: PVNV (0x1a7ede34) "@\226\225\205">
40         print "# [$a]\nnot " unless $a =~ /sv_undef.*PVNV.*\@\\[0-9].*sv_undef.*AV/s;
41     }
42 }
43 ok;