source: trunk/essentials/dev-lang/perl/t/op/runlevel.t

Last change on this file was 3181, checked in by bird, 19 years ago

perl 5.8.8

File size: 6.6 KB
Line 
1#!./perl
2
3##
4## Many of these tests are originally from Michael Schroeder
5## <[email protected]>
6## Adapted and expanded by Gurusamy Sarathy <[email protected]>
7##
8
9chdir 't' if -d 't';
10@INC = '../lib';
11$Is_VMS = $^O eq 'VMS';
12$Is_MSWin32 = $^O eq 'MSWin32';
13$Is_NetWare = $^O eq 'NetWare';
14$Is_MacOS = $^O eq 'MacOS';
15$ENV{PERL5LIB} = "../lib" unless $Is_VMS;
16
17$|=1;
18
19undef $/;
20@prgs = split "\n########\n", <DATA>;
21print "1..", scalar @prgs, "\n";
22
23$tmpfile = "runltmp000";
241 while -f ++$tmpfile;
25END { if ($tmpfile) { 1 while unlink $tmpfile; } }
26
27for (@prgs){
28 my $switch = "";
29 if (s/^\s*(-\w+)//){
30 $switch = $1;
31 }
32 my($prog,$expected) = split(/\nEXPECT\n/, $_);
33 open TEST, ">$tmpfile";
34 print TEST "$prog\n";
35 close TEST or die "Could not close: $!";
36 my $results = $Is_VMS ?
37 `MCR $^X "-I[-.lib]" $switch $tmpfile 2>&1` :
38 $Is_MSWin32 ?
39 `.\\perl -I../lib $switch $tmpfile 2>&1` :
40 $Is_NetWare ?
41 `perl -I../lib $switch $tmpfile 2>&1` :
42 $Is_MacOS ?