xref: /onnv-gate/usr/src/cmd/perl/5.8.4/distrib/ext/B/t/stash.t (revision 0:68f95e015346)
1#!./perl
2
3BEGIN {
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;
13use warnings;
14use strict;
15use Config;
16
17print "1..1\n";
18
19my $test = 1;
20
21sub ok { print "ok $test\n"; $test++ }
22
23
24my $got;
25my $Is_VMS = $^O eq 'VMS';
26my $Is_MacOS = $^O eq 'MacOS';
27
28my $path = join " ", map { qq["-I$_"] } @INC;
29$path = '"-I../lib" "-Iperl_root:[lib]"' if $Is_VMS;   # gets too long otherwise
30my $redir = $Is_MacOS ? "" : "2>&1";
31
32chomp($got = `$^X $path "-MB::Stash" "-Mwarnings" -e1`);
33
34$got =~ s/-u//g;
35
36print "# got = $got\n";
37
38my @got = map { s/^\S+ //; $_ }
39              sort { $a cmp $b }
40                   map { lc($_) . " " . $_ }
41                       split /,/, $got;
42
43print "# (after sorting)\n";
44print "# got = @got\n";
45
46@got = grep { ! /^(PerlIO|open)(?:::\w+)?$/ } @got;
47
48print "# (after perlio censorings)\n";
49print "# 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
56if ($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
64print "# (after platform censorings)\n";
65print "# got = @got\n";
66
67$got = "@got";
68
69my $expected = "attributes Carp Carp::Heavy DB Exporter Exporter::Heavy Internals main Regexp utf8 warnings";
70
71{
72    no strict 'vars';
73    use vars '$OS2::is_aout';
74}
75
76if ((($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
85