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