Bytecode patching from Enache.
[p5sagit/p5-mst-13.2.git] / ext / B / t / stash.t
CommitLineData
87a42246 1#!./perl
2
3BEGIN {
88587957 4 chdir 't' if -d 't';
87a42246 5 if ($^O eq 'MacOS') {
6 @INC = qw(: ::lib ::macos:lib);
88587957 7 } else {
8 @INC = '../lib';
87a42246 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
9fc0d0ff 24my $got;
87a42246 25my $Is_VMS = $^O eq 'VMS';
26my $Is_MacOS = $^O eq 'MacOS';
27
28my $path = join " ", map { qq["-I$_"] } @INC;
c614a829 29$path = '"-I../lib" "-Iperl_root:[lib]"' if $Is_VMS; # gets too long otherwise
87a42246 30my $redir = $Is_MacOS ? "" : "2>&1";
31
9fc0d0ff 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';
87a42246 55
38535c98 56if ($Is_VMS) {
9fc0d0ff 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;
38535c98 62}
371ddd85 63
9fc0d0ff 64print "# (after platform censorings)\n";
65print "# got = @got\n";
66
67$got = "@got";
68
39cff0d9 69my $expected = "attributes Carp Carp::Heavy DB Exporter Exporter::Heavy Internals main Regexp utf8 version warnings";
9fc0d0ff 70
371ddd85 71{
72 no strict 'vars';
73 use vars '$OS2::is_aout';
74}
9fc0d0ff 75
c614a829 76if ((($Config{static_ext} eq ' ') || ($Config{static_ext} eq ''))
347fb945 77 && !($^O eq 'os2' and $OS2::is_aout)
371ddd85 78 ) {
9fc0d0ff 79 print "# [$got]\n# vs.\n# [$expected]\nnot " if $got ne $expected;
371ddd85 80 ok;
87a42246 81} else {
371ddd85 82 print "ok $test # skipped: one or more static extensions\n"; $test++;
87a42246 83}
371ddd85 84