6 $ENV{PERL5LIB} = '../lib';
11 my $Is_VMS = $^O eq 'VMS';
12 my $tmpfile = "tmp0000";
14 1 while -f ++$tmpfile;
15 END { if ($tmpfile) { 1 while unlink $tmpfile; } }
19 foreach (sort glob("pragma/strict-*")) {
21 open F, "<$_" or die "Cannot open $_: $!\n" ;
28 @prgs = (@prgs, split "\n########\n", <F>) ;
35 print "1..", scalar @prgs, "\n";
44 my($prog,$expected) = split(/\nEXPECT\n/, $_);
45 if ( $prog =~ /--FILE--/) {
46 my(@files) = split(/\n--FILE--\s*([^\s\n]*)\s*\n/, $prog) ;
48 die "Internal error test $i didn't split into pairs, got " .
49 scalar(@files) . "[" . join("%%%%", @files) ."]\n"
52 my $filename = shift @files ;
53 my $code = shift @files ;
54 push @temps, $filename ;
55 open F, ">$filename" or die "Cannot open $filename: $!\n" ;
60 $prog = shift @files ;
62 open TEST, ">$tmpfile";
63 print TEST $prog,"\n";
65 my $results = $Is_VMS ?
66 `MCR $^X $switch $tmpfile` :
67 `sh -c './perl $switch $tmpfile' 2>&1`;
70 # allow expected output to be written as if $prog is on STDIN
71 $results =~ s/tmp\d+/-/g;
72 $results =~ s/\n%[A-Z]+-[SIWEF]-.*$// if $Is_VMS; # clip off DCL status msg
73 $expected =~ s/\n+$//;
74 my $prefix = ($results =~ s/^PREFIX\n//) ;
75 if ( $results =~ s/^SKIPPED\n//) {
78 elsif (($prefix and $results !~ /^\Q$expected/) or
79 (!$prefix and $results ne $expected)){
80 print STDERR "PROG: $switch\n$prog\n";
81 print STDERR "EXPECTED:\n$expected\n";
82 print STDERR "GOT:\n$results\n";
85 print "ok ", ++$i, "\n";