Re: perlfunc.pod/split; concerning trailing fields
[p5sagit/p5-mst-13.2.git] / ext / B / t / debug.t
CommitLineData
87a42246 1#!./perl
2
3BEGIN {
5638aaac 4 if ($ENV{PERL_CORE}){
5 chdir('t') if -d 't';
6 if ($^O eq 'MacOS') {
7 @INC = qw(: ::lib ::macos:lib);
8 } else {
9 @INC = '.';
10 push @INC, '../lib';
11 }
87a42246 12 } else {
5638aaac 13 unshift @INC, 't';
87a42246 14 }
9cd8f857 15 require Config;
16 if (($Config::Config{'extensions'} !~ /\bB\b/) ){
17 print "1..0 # Skip -- Perl configured without B module\n";
18 exit 0;
19 }
87a42246 20}
21
22$| = 1;
23use warnings;
24use strict;
25use Config;
f071ed12 26use Test::More tests=>3;
87a42246 27
28my $a;
29my $Is_VMS = $^O eq 'VMS';
30my $Is_MacOS = $^O eq 'MacOS';
31
32my $path = join " ", map { qq["-I$_"] } @INC;
33my $redir = $Is_MacOS ? "" : "2>&1";
34
35$a = `$^X $path "-MO=Debug" -e 1 $redir`;
f071ed12 36like($a, qr/\bLISTOP\b.*\bOP\b.*\bCOP\b.*\bOP\b/s);
87a42246 37
38
39$a = `$^X $path "-MO=Terse" -e 1 $redir`;
f071ed12 40like($a, qr/\bLISTOP\b.*leave.*\n OP\b.*enter.*\n COP\b.*nextstate.*\n OP\b.*null/s);
87a42246 41
42$a = `$^X $path "-MO=Terse" -ane "s/foo/bar/" $redir`;
43$a =~ s/\(0x[^)]+\)//g;
44$a =~ s/\[[^\]]+\]//g;
45$a =~ s/-e syntax OK//;
46$a =~ s/[^a-z ]+//g;
47$a =~ s/\s+/ /g;
48$a =~ s/\b(s|foo|bar|ullsv)\b\s?//g;
49$a =~ s/^\s+//;
50$a =~ s/\s+$//;
51my $is_thread = $Config{use5005threads} && $Config{use5005threads} eq 'define';
52if ($is_thread) {
53 $b=<<EOF;
54leave enter nextstate label leaveloop enterloop null and defined null
55threadsv readline gv lineseq nextstate aassign null pushmark split pushre
241416b8 56threadsv const null pushmark rvav gv nextstate subst const unstack
87a42246 57EOF
58} else {
59 $b=<<EOF;
60leave enter nextstate label leaveloop enterloop null and defined null
61null gvsv readline gv lineseq nextstate aassign null pushmark split pushre
241416b8 62null gvsv const null pushmark rvav gv nextstate subst const unstack
87a42246 63EOF
64}
65$b=~s/\n/ /g;$b=~s/\s+/ /g;
66$b =~ s/\s+$//;
f071ed12 67is($a, $b);
87a42246 68