6 $ENV{PERL5LIB} = '../lib';
12 my $Is_VMS = $^O eq 'VMS';
13 my $Is_MSWin32 = $^O eq 'MSWin32';
14 my $Is_NetWare = $^O eq 'NetWare';
19 foreach (sort glob("lib/strict/*")) {
21 next if -d || /(~|\.orig|,v)$/;
23 open F, "<$_" or die "Cannot open $_: $!\n" ;
30 @prgs = (@prgs, split "\n########\n", <F>) ;
32 close F or die "Could not close: $!" ;
37 print "1.." . (@prgs + 4) . "\n";
46 my($prog,$expected) = split(/\nEXPECT\n/, $_);
47 if ( $prog =~ /--FILE--/) {
48 my(@files) = split(/\n--FILE--\s*([^\s\n]*)\s*\n/, $prog) ;
50 die "Internal error test $i didn't split into pairs, got " .
51 scalar(@files) . "[" . join("%%%%", @files) ."]\n"
54 my $filename = shift @files ;
55 my $code = shift @files ;
56 push @temps, $filename ;
57 open F, ">$filename" or die "Cannot open $filename: $!\n" ;
59 close F or die "Could not close: $!" ;
62 $prog = shift @files ;
64 my $tmpfile = tempfile();
65 open TEST, ">$tmpfile" or die "Could not open: $!";
66 print TEST $prog,"\n";
67 close TEST or die "Could not close: $!";
68 my $results = $Is_MSWin32 ?
69 `.\\perl -I../lib $switch $tmpfile 2>&1` :
71 `perl -I../lib $switch $tmpfile 2>&1` :
72 `$^X $switch $tmpfile 2>&1`;
75 # allow expected output to be written as if $prog is on STDIN
76 $results =~ s/tmp\d+[A-Z][A-Z]?/-/g;
77 $results =~ s/\n%[A-Z]+-[SIWEF]-.*$// if $Is_VMS; # clip off DCL status msg
78 $expected =~ s/\n+$//;
79 my $prefix = ($results =~ s/^PREFIX\n//) ;
80 my $TODO = $prog =~ m/^#\s*TODO:/;
81 if ( $results =~ s/^SKIPPED\n//) {
84 elsif (($prefix and $results !~ /^\Q$expected/) or
85 (!$prefix and $results ne $expected)){
87 print STDERR "PROG: $switch\n$prog\n";
88 print STDERR "EXPECTED:\n$expected\n";
89 print STDERR "GOT:\n$results\n";
93 print "ok " . ++$i . ($TODO ? " # TODO" : "") . "\n";
98 eval qq(use strict 'garbage');
99 print +($@ =~ /^Unknown 'strict' tag\(s\) 'garbage'/)
100 ? "ok ".++$i."\n" : "not ok ".++$i."\t# $@";
102 eval qq(no strict 'garbage');
103 print +($@ =~ /^Unknown 'strict' tag\(s\) 'garbage'/)
104 ? "ok ".++$i."\n" : "not ok ".++$i."\t# $@";
106 eval qq(use strict qw(foo bar));
107 print +($@ =~ /^Unknown 'strict' tag\(s\) 'foo bar'/)
108 ? "ok ".++$i."\n" : "not ok ".++$i."\t# $@";
110 eval qq(no strict qw(foo bar));
111 print +($@ =~ /^Unknown 'strict' tag\(s\) 'foo bar'/)
112 ? "ok ".++$i."\n" : "not ok ".++$i."\t# $@";