xref: /onnv-gate/usr/src/cmd/perl/5.8.4/distrib/ext/B/t/stash.t (revision 0:68f95e015346)
1*0Sstevel@tonic-gate#!./perl
2*0Sstevel@tonic-gate
3*0Sstevel@tonic-gateBEGIN {
4*0Sstevel@tonic-gate    chdir 't' if -d 't';
5*0Sstevel@tonic-gate    if ($^O eq 'MacOS') {
6*0Sstevel@tonic-gate	@INC = qw(: ::lib ::macos:lib);
7*0Sstevel@tonic-gate    } else {
8*0Sstevel@tonic-gate	@INC = '../lib';
9*0Sstevel@tonic-gate    }
10*0Sstevel@tonic-gate}
11*0Sstevel@tonic-gate
12*0Sstevel@tonic-gate$|  = 1;
13*0Sstevel@tonic-gateuse warnings;
14*0Sstevel@tonic-gateuse strict;
15*0Sstevel@tonic-gateuse Config;
16*0Sstevel@tonic-gate
17*0Sstevel@tonic-gateprint "1..1\n";
18*0Sstevel@tonic-gate
19*0Sstevel@tonic-gatemy $test = 1;
20*0Sstevel@tonic-gate
21*0Sstevel@tonic-gatesub ok { print "ok $test\n"; $test++ }
22*0Sstevel@tonic-gate
23*0Sstevel@tonic-gate
24*0Sstevel@tonic-gatemy $got;
25*0Sstevel@tonic-gatemy $Is_VMS = $^O eq 'VMS';
26*0Sstevel@tonic-gatemy $Is_MacOS = $^O eq 'MacOS';
27*0Sstevel@tonic-gate
28*0Sstevel@tonic-gatemy $path = join " ", map { qq["-I$_"] } @INC;
29*0Sstevel@tonic-gate$path = '"-I../lib" "-Iperl_root:[lib]"' if $Is_VMS;   # gets too long otherwise
30*0Sstevel@tonic-gatemy $redir = $Is_MacOS ? "" : "2>&1";
31*0Sstevel@tonic-gate
32*0Sstevel@tonic-gatechomp($got = `$^X $path "-MB::Stash" "-Mwarnings" -e1`);
33*0Sstevel@tonic-gate
34*0Sstevel@tonic-gate$got =~ s/-u//g;
35*0Sstevel@tonic-gate
36*0Sstevel@tonic-gateprint "# got = $got\n";
37*0Sstevel@tonic-gate
38*0Sstevel@tonic-gatemy @got = map { s/^\S+ //; $_ }
39*0Sstevel@tonic-gate              sort { $a cmp $b }
40*0Sstevel@tonic-gate                   map { lc($_) . " " . $_ }
41*0Sstevel@tonic-gate                       split /,/, $got;
42*0Sstevel@tonic-gate
43*0Sstevel@tonic-gateprint "# (after sorting)\n";
44*0Sstevel@tonic-gateprint "# got = @got\n";
45*0Sstevel@tonic-gate
46*0Sstevel@tonic-gate@got = grep { ! /^(PerlIO|open)(?:::\w+)?$/ } @got;
47*0Sstevel@tonic-gate
48*0Sstevel@tonic-gateprint "# (after perlio censorings)\n";
49*0Sstevel@tonic-gateprint "# got = @got\n";
50*0Sstevel@tonic-gate
51*0Sstevel@tonic-gate@got = grep { ! /^Win32$/                     } @got  if $^O eq 'MSWin32';
52*0Sstevel@tonic-gate@got = grep { ! /^NetWare$/                   } @got  if $^O eq 'NetWare';
53*0Sstevel@tonic-gate@got = grep { ! /^(Cwd|File|File::Copy|OS2)$/ } @got  if $^O eq 'os2';
54*0Sstevel@tonic-gate@got = grep { ! /^Cwd$/                       } @got  if $^O eq 'cygwin';
55*0Sstevel@tonic-gate
56*0Sstevel@tonic-gateif ($Is_VMS) {
57*0Sstevel@tonic-gate    @got = grep { ! /^File(?:::Copy)?$/    } @got;
58*0Sstevel@tonic-gate    @got = grep { ! /^VMS(?:::Filespec)?$/ } @got;
59*0Sstevel@tonic-gate    @got = grep { ! /^vmsish$/             } @got;
60*0Sstevel@tonic-gate     # Socket is optional/compiler version dependent
61*0Sstevel@tonic-gate    @got = grep { ! /^Socket$/             } @got;
62*0Sstevel@tonic-gate}
63*0Sstevel@tonic-gate
64*0Sstevel@tonic-gateprint "# (after platform censorings)\n";
65*0Sstevel@tonic-gateprint "# got = @got\n";
66*0Sstevel@tonic-gate
67*0Sstevel@tonic-gate$got = "@got";
68*0Sstevel@tonic-gate
69*0Sstevel@tonic-gatemy $expected = "attributes Carp Carp::Heavy DB Exporter Exporter::Heavy Internals main Regexp utf8 warnings";
70*0Sstevel@tonic-gate
71*0Sstevel@tonic-gate{
72*0Sstevel@tonic-gate    no strict 'vars';
73*0Sstevel@tonic-gate    use vars '$OS2::is_aout';
74*0Sstevel@tonic-gate}
75*0Sstevel@tonic-gate
76*0Sstevel@tonic-gateif ((($Config{static_ext} eq ' ') || ($Config{static_ext} eq ''))
77*0Sstevel@tonic-gate    && !($^O eq 'os2' and $OS2::is_aout)
78*0Sstevel@tonic-gate	) {
79*0Sstevel@tonic-gate    print "# [$got]\n# vs.\n# [$expected]\nnot " if $got ne $expected;
80*0Sstevel@tonic-gate    ok;
81*0Sstevel@tonic-gate} else {
82*0Sstevel@tonic-gate    print "ok $test # skipped: one or more static extensions\n"; $test++;
83*0Sstevel@tonic-gate}
84*0Sstevel@tonic-gate
85