xref: /onnv-gate/usr/src/cmd/perl/5.8.4/distrib/t/comp/script.t (revision 0:68f95e015346)
1*0Sstevel@tonic-gate#!./perl
2*0Sstevel@tonic-gate
3*0Sstevel@tonic-gateBEGIN {
4*0Sstevel@tonic-gate    chdir 't';
5*0Sstevel@tonic-gate    @INC = '../lib';
6*0Sstevel@tonic-gate    require './test.pl';	# for which_perl() etc
7*0Sstevel@tonic-gate}
8*0Sstevel@tonic-gate
9*0Sstevel@tonic-gatemy $Perl = which_perl();
10*0Sstevel@tonic-gate
11*0Sstevel@tonic-gateprint "1..3\n";
12*0Sstevel@tonic-gate
13*0Sstevel@tonic-gate$x = `$Perl -le "print 'ok';"`;
14*0Sstevel@tonic-gate
15*0Sstevel@tonic-gateif ($x eq "ok\n") {print "ok 1\n";} else {print "not ok 1\n";}
16*0Sstevel@tonic-gate
17*0Sstevel@tonic-gateopen(try,">Comp.script") || (die "Can't open temp file.");
18*0Sstevel@tonic-gateprint try 'print "ok\n";'; print try "\n";
19*0Sstevel@tonic-gateclose try or die "Could not close: $!";
20*0Sstevel@tonic-gate
21*0Sstevel@tonic-gate$x = `$Perl Comp.script`;
22*0Sstevel@tonic-gate
23*0Sstevel@tonic-gateif ($x eq "ok\n") {print "ok 2\n";} else {print "not ok 2\n";}
24*0Sstevel@tonic-gate
25*0Sstevel@tonic-gate$x = `$Perl <Comp.script`;
26*0Sstevel@tonic-gate
27*0Sstevel@tonic-gateif ($x eq "ok\n") {print "ok 3\n";} else {print "not ok 3\n";}
28*0Sstevel@tonic-gate
29*0Sstevel@tonic-gateunlink 'Comp.script' || `/bin/rm -f Comp.script`;
30