xref: /openbsd-src/gnu/usr.bin/perl/t/run/script.t (revision b8851fcc53cbe24fd20b090f26dd149e353f6174)
1b39c5158Smillert#!./perl
2b39c5158Smillert
3b39c5158SmillertBEGIN {
4*b8851fccSafresh1    chdir 't' if -d 't';
5b39c5158Smillert    @INC = '../lib';
6b39c5158Smillert    require './test.pl';	# for which_perl() etc
791f110e0Safresh1    plan(3);
8b39c5158Smillert}
9b39c5158Smillert
10b39c5158Smillertmy $Perl = which_perl();
11b39c5158Smillert
12b39c5158Smillertmy $filename = tempfile();
13b39c5158Smillert
14b39c5158Smillert$x = `$Perl -le "print 'ok';"`;
15b39c5158Smillert
1691f110e0Safresh1is($x, "ok\n", "Got expected 'perl -le' output");
17b39c5158Smillert
18b39c5158Smillertopen(try,">$filename") || (die "Can't open temp file.");
19b39c5158Smillertprint try 'print "ok\n";'; print try "\n";
20b39c5158Smillertclose try or die "Could not close: $!";
21b39c5158Smillert
22b39c5158Smillert$x = `$Perl $filename`;
23b39c5158Smillert
2491f110e0Safresh1is($x, "ok\n", "Got expected output of command from script");
25b39c5158Smillert
26b39c5158Smillert$x = `$Perl <$filename`;
27b39c5158Smillert
2891f110e0Safresh1is($x, "ok\n", "Got expected output of command read from script");
29