Bump $B::Deparse::VERSION
[p5sagit/p5-mst-13.2.git] / ext / B / t / stash.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     require Config;
11     if (($Config::Config{'extensions'} !~ /\bB\b/) ){
12         print "1..0 # Skip -- Perl configured without B module\n";
13         exit 0;
14     }
15 }
16
17 $|  = 1;
18 use warnings;
19 use strict;
20 use Config;
21
22 print "1..1\n";
23
24 my $test = 1;
25
26 sub ok { print "ok $test\n"; $test++ }
27
28
29 my $got;
30 my $Is_VMS = $^O eq 'VMS';
31 my $Is_MacOS = $^O eq 'MacOS';
32
33 my $path = join " ", map { qq["-I$_"] } @INC;
34 $path = '"-I../lib" "-Iperl_root:[lib]"' if $Is_VMS;   # gets too long otherwise
35 my $redir = $Is_MacOS ? "" : "2>&1";
36
37 chomp($got = `$^X $path "-MB::Stash" "-Mwarnings" -e1`);
38
39 $got =~ s/-u//g;
40
41 print "# got = $got\n";
42
43 my @got = map { s/^\S+ //; $_ }
44               sort { $a cmp $b }
45                    map { lc($_) . " " . $_ }
46                        split /,/, $got;
47
48 print "# (after sorting)\n";
49 print "# got = @got\n";
50
51 @got = grep { ! /^(PerlIO|open)(?:::\w+)?$/ } @got;
52
53 print "# (after perlio censorings)\n";
54 print "# got = @got\n";
55
56 @got = grep { ! /^Win32$/                     } @got  if $^O eq 'MSWin32';
57 @got = grep { ! /^NetWare$/                   } @got  if $^O eq 'NetWare';
58 @got = grep { ! /^(Cwd|File|File::Copy|OS2)$/ } @got  if $^O eq 'os2';
59 @got = grep { ! /^Cwd$/                       } @got  if $^O eq 'cygwin';
60
61 if ($Is_VMS) {
62     @got = grep { ! /^File(?:::Copy)?$/    } @got;
63     @got = grep { ! /^VMS(?:::Filespec)?$/ } @got;
64     @got = grep { ! /^vmsish$/             } @got;
65      # Socket is optional/compiler version dependent
66     @got = grep { ! /^Socket$/             } @got;
67 }
68
69 print "# (after platform censorings)\n";
70 print "# got = @got\n";
71
72 $got = "@got";
73
74 my $expected = "attributes Carp Carp::Heavy DB Exporter Exporter::Heavy Internals main Regexp utf8 version warnings";
75
76 {
77     no strict 'vars';
78     use vars '$OS2::is_aout';
79 }
80
81 if ((($Config{static_ext} eq ' ') || ($Config{static_ext} eq ''))
82     && !($^O eq 'os2' and $OS2::is_aout)
83         ) {
84     print "# [$got]\n# vs.\n# [$expected]\nnot " if $got ne $expected;
85     ok;
86 } else {
87     print "ok $test # skipped: one or more static extensions\n"; $test++;
88 }
89