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