6 $ENV{PERL5LIB} = '../lib';
11 my $Is_VMS = $^O eq 'VMS';
12 my $Is_MSWin32 = $^O eq 'MSWin32';
13 my $Is_NetWare = $^O eq 'NetWare';
14 my $tmpfile = "tmp0000";
16 1 while -e ++$tmpfile;
17 END { if ($tmpfile) { 1 while unlink $tmpfile; } }
21 foreach (sort glob($^O eq 'MacOS' ? ":lib:strict:*" : "lib/strict/*")) {
23 next if -d || /(~|\.orig|,v)$/;
25 open F, "<$_" or die "Cannot open $_: $!\n" ;
32 @prgs = (@prgs, split "\n########\n", <F>) ;
34 close F or die "Could not close: $!" ;
39 print "1.." . (@prgs + 4) . "\n";
48 my($prog,$expected) = split(/\nEXPECT\n/, $_);
49 if ( $prog =~ /--FILE--/) {
50 my(@files) = split(/\n--FILE--\s*([^\s\n]*)\s*\n/, $prog) ;
52 die "Internal error test $i didn't split into pairs, got " .
53 scalar(@files) . "[" . join("%%%%", @files) ."]\n"
56 my $filename = shift @files ;
57 my $code = shift @files ;
58 $code =~ s|\./abc|:abc|g if $^O eq 'MacOS';
59 push @temps, $filename ;
60 open F, ">$filename" or die "Cannot open $filename: $!\n" ;
62 close F or die "Could not close: $!" ;
65 $prog = shift @files ;
66 $prog =~ s|\./abc|:abc|g if $^O eq 'MacOS';
68 open TEST, ">$tmpfile" or die "Could not open: $!";
69 print TEST $prog,"\n";
70 close TEST or die "Could not close: $!";
71 my $results = $Is_MSWin32 ?
72 `.\\perl -I../lib $switch $tmpfile 2>&1` :
74 `perl -I../lib $switch $tmpfile 2>&1` :
76 `$^X -I::lib -MMac::err=unix $switch $tmpfile` :
77 `$^X $switch $tmpfile 2>&1`;
80 # allow expected output to be written as if $prog is on STDIN
81 $results =~ s/tmp\d+/-/g;
82 $results =~ s/\n%[A-Z]+-[SIWEF]-.*$// if $Is_VMS; # clip off DCL status msg
83 $expected =~ s/\n+$//;
84 $expected =~ s|(\./)?abc\.pm|:abc.pm|g if $^O eq 'MacOS';
85 $expected =~ s|./abc|:abc|g if $^O eq 'MacOS';
86 my $prefix = ($results =~ s/^PREFIX\n//) ;
87 if ( $results =~ s/^SKIPPED\n//) {
90 elsif (($prefix and $results !~ /^\Q$expected/) or
91 (!$prefix and $results ne $expected)){
92 print STDERR "PROG: $switch\n$prog\n";
93 print STDERR "EXPECTED:\n$expected\n";
94 print STDERR "GOT:\n$results\n";
97 print "ok " . ++$i . "\n";
102 eval qq(use strict 'garbage');
103 print +($@ =~ /^Unknown 'strict' tag\(s\) 'garbage'/)
104 ? "ok ".++$i."\n" : "not ok ".++$i."\t# $@";
106 eval qq(no strict 'garbage');
107 print +($@ =~ /^Unknown 'strict' tag\(s\) 'garbage'/)
108 ? "ok ".++$i."\n" : "not ok ".++$i."\t# $@";
110 eval qq(use strict qw(foo bar));
111 print +($@ =~ /^Unknown 'strict' tag\(s\) 'foo bar'/)
112 ? "ok ".++$i."\n" : "not ok ".++$i."\t# $@";
114 eval qq(no strict qw(foo bar));
115 print +($@ =~ /^Unknown 'strict' tag\(s\) 'foo bar'/)
116 ? "ok ".++$i."\n" : "not ok ".++$i."\t# $@";