| 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 |
|
|---|
| 9 | chdir '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 |
|
|---|
| 19 | undef $/;
|
|---|
| 20 | @prgs = split "\n########\n", <DATA>;
|
|---|
| 21 | print "1..", scalar @prgs, "\n";
|
|---|
| 22 |
|
|---|
| 23 | $tmpfile = "runltmp000";
|
|---|
| 24 | 1 while -f ++$tmpfile;
|
|---|
| 25 | END { if ($tmpfile) { 1 while unlink $tmpfile; } }
|
|---|
| 26 |
|
|---|
| 27 | for (@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 ?
|
|---|
|
|---|