Cleanup the stash test, and reclaim it in non-ASCII-sorting
[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 }
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
24 my $got;
25 my $Is_VMS = $^O eq 'VMS';
26 my $Is_MacOS = $^O eq 'MacOS';
27
28 my $path = join " ", map { qq["-I$_"] } @INC;
29 $path = '"-I../lib" "-Iperl_root:[lib]"' if $Is_VMS;   # gets too long otherwise
30 my $redir = $Is_MacOS ? "" : "2>&1";
31
32 chomp($got = `$^X $path "-MB::Stash" "-Mwarnings" -e1`);
33
34 $got =~ s/-u//g;
35
36 print "# got = $got\n";
37
38 my @got = map { s/^\S+ //; $_ }
39               sort { $a cmp $b }
40                    map { lc($_) . " " . $_ }
41                        split /,/, $got;
42
43 print "# (after sorting)\n";
44 print "# got = @got\n";
45
46 @got = grep { ! /^(PerlIO|open)(?:::\w+)?$/ } @got;
47
48 print "# (after perlio censorings)\n";
49 print "# got = @got\n";
50
51 @got = grep { ! /^Win32$/                     } @got  if $^O eq 'MSWin32';
52 @got = grep { ! /^NetWare$/                   } @got  if $^O eq 'NetWare';
53 @got = grep { ! /^(Cwd|File|File::Copy|OS2)$/ } @got  if $^O eq 'os2';
54 @got = grep { ! /^Cwd$/                       } @got  if $^O eq 'cygwin';
55
56 if ($Is_VMS) {
57     @got = grep { ! /^File(?:::Copy)?$/    } @got;
58     @got = grep { ! /^VMS(?:::Filespec)?$/ } @got;
59     @got = grep { ! /^vmsish$/             } @got;
60      # Socket is optional/compiler version dependent
61     @got = grep { ! /^Socket$/             } @got;
62 }
63
64 print "# (after platform censorings)\n";
65 print "# got = @got\n";
66
67 $got = "@got";
68
69 my $expected = "access attributes Carp Carp::Heavy DB Exporter Exporter::Heavy main utf8 warnings";
70
71 {
72     no strict 'vars';
73     use vars '$OS2::is_aout';
74 }
75
76 if ((($Config{static_ext} eq ' ') || ($Config{static_ext} eq ''))
77     && !($^O eq 'os2' and $OS2::is_aout)
78         ) {
79     print "# [$got]\n# vs.\n# [$expected]\nnot " if $got ne $expected;
80     ok;
81 } else {
82     print "ok $test # skipped: one or more static extensions\n"; $test++;
83 }
84