This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Move all the xxxpvs() macros to handy.h.
[perl5.git] / ext / B / t / stash.t
CommitLineData
87a42246
MS
1#!./perl
2
3BEGIN {
5638aaac
SM
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
NC
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
MS
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
MS
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
MS
40my $redir = $Is_MacOS ? "" : "2>&1";
41
9fc0d0ff
JH
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';
85ca3158 64@got = grep { ! /^(Cwd|Cygwin)$/ } @got if $^O eq 'cygwin';
87a42246 65
38535c98 66if ($Is_VMS) {
9fc0d0ff
JH
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
JH
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
4581844a
NC
81if ($] < 5.009) {
82 $expected =~ s/version //;
83 $expected =~ s/DB/DB Exporter Exporter::Heavy/;
84}
7252851f 85
371ddd85
JH
86{
87 no strict 'vars';
88 use vars '$OS2::is_aout';
89}
9fc0d0ff 90
c614a829 91if ((($Config{static_ext} eq ' ') || ($Config{static_ext} eq ''))
347fb945 92 && !($^O eq 'os2' and $OS2::is_aout)
371ddd85 93 ) {
09e96b99 94 print "# got [$got]\n# vs.\n# expected [$expected]\nnot " if $got ne $expected;
371ddd85 95 ok;
87a42246 96} else {
371ddd85 97 print "ok $test # skipped: one or more static extensions\n"; $test++;
87a42246 98}
371ddd85 99