This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Test preamble: unify chdir 't' if -d 't';
[perl5.git] / t / run / script.t
1 #!./perl
2
3 BEGIN {
4     chdir 't' if -d 't';
5     @INC = '../lib';
6     require './test.pl';        # for which_perl() etc
7     plan(3);
8 }
9
10 my $Perl = which_perl();
11
12 my $filename = tempfile();
13
14 $x = `$Perl -le "print 'ok';"`;
15
16 is($x, "ok\n", "Got expected 'perl -le' output");
17
18 open(try,">$filename") || (die "Can't open temp file.");
19 print try 'print "ok\n";'; print try "\n";
20 close try or die "Could not close: $!";
21
22 $x = `$Perl $filename`;
23
24 is($x, "ok\n", "Got expected output of command from script");
25
26 $x = `$Perl <$filename`;
27
28 is($x, "ok\n", "Got expected output of command read from script");