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