diff options
author | Michael G. Schwern <schwern@pobox.com> | 2001-12-06 17:56:34 -0500 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2001-12-07 03:07:03 +0000 |
commit | 972e7321890d17fb9c105d15681c3146dfb7c1cc (patch) | |
tree | f2e6dfd489b6a09029f7bd3622d2c1b9abf7d45c | |
parent | b5fe401bfa4db89e5f67b4efa27cfb15826a0dcc (diff) | |
download | perl-972e7321890d17fb9c105d15681c3146dfb7c1cc.tar.gz |
Test For Echo, take 2
Message-ID: <20011207035634.GO22648@blackrider>
p4raw-id: //depot/perl@13507
-rwxr-xr-x | t/base/lex.t | 4 | ||||
-rwxr-xr-x | t/op/exec.t | 26 |
2 files changed, 20 insertions, 10 deletions
diff --git a/t/base/lex.t b/t/base/lex.t index 54d6c93c5e..4166c18194 100755 --- a/t/base/lex.t +++ b/t/base/lex.t @@ -53,8 +53,8 @@ $foo EOF EOE -print <<`EOS` . <<\EOF; -echo ok 12 +print <<'EOS' . <<\EOF; +ok 12 - make sure single quotes are honored \nnot ok EOS ok 13 EOF diff --git a/t/op/exec.t b/t/op/exec.t index 068cac3a7e..1be58fe5cc 100755 --- a/t/op/exec.t +++ b/t/op/exec.t @@ -3,6 +3,7 @@ BEGIN: { chdir 't' if -d 't'; @INC = ('../lib'); + require './test.pl'; } # supress VMS whinging about bad execs. @@ -13,35 +14,36 @@ $| = 1; # flush stdout $ENV{LC_ALL} = 'C'; # Forge English error messages. $ENV{LANGUAGE} = 'C'; # Ditto in GNU. -require './test.pl'; -plan(tests => 12); +plan(tests => 14); + +my $Perl = which_perl(); my $exit; SKIP: { skip("bug/feature of pdksh", 2) if $^O eq 'os2'; - $exit = system qq{$^X -le "print q{ok 1 - interpreted system(EXPR)"}}; + $exit = system qq{$Perl -le "print q{ok 1 - interpreted system(EXPR)"}}; next_test(); is( $exit, 0, ' exited 0' ); } -$exit = system qq{$^X -le "print q{ok 3 - split & direct call system(EXPR)"}}; +$exit = system qq{$Perl -le "print q{ok 3 - split & direct call system(EXPR)"}}; next_test(); is( $exit, 0, ' exited 0' ); # On VMS you need the quotes around the program or it won't work. # On Unix its the opposite. my $quote = $^O eq 'VMS' ? '"' : ''; -$exit = system $^X, '-le', +$exit = system $Perl, '-le', "${quote}print q{ok 5 - system(PROG, LIST)}${quote}"; next_test(); is( $exit, 0, ' exited 0' ); -is( system(qq{$^X -e "exit 0"}), 0, 'Explicit exit of 0' ); +is( system(qq{$Perl -e "exit 0"}), 0, 'Explicit exit of 0' ); my $exit_one = $^O eq 'VMS' ? 4 << 8 : 1 << 8; -is( system(qq{$^X "-I../lib" -e "use vmsish qw(hushed); exit 1"}), $exit_one, +is( system(qq{$Perl "-I../lib" -e "use vmsish qw(hushed); exit 1"}), $exit_one, 'Explicit exit of 1' ); @@ -56,6 +58,13 @@ unless ( ok( $! == 2 or $! =~ /\bno\b.*\bfile/i or printf "# \$! eq %d, '%s'\n", $!, $!; } + +is( `$Perl -le "print 'ok'"`, "ok\n", 'basic ``' ); +is( <<`END`, "ok\n", '<<`HEREDOC`' ); +$Perl -le "print 'ok'" +END + + TODO: { if( $^O =~ /Win32/ ) { print "not ok 11 - exec failure doesn't terminate process # TODO Win32 exec failure waits for user input\n"; @@ -66,5 +75,6 @@ TODO: { "exec failure doesn't terminate process"); } -exec $^X, '-le', qq{${quote}print 'ok 12 - exec PROG, LIST'${quote}}; +my $test = curr_test(); +exec $Perl, '-le', qq{${quote}print 'ok $test - exec PROG, LIST'${quote}}; fail("This should never be reached if the exec() worked"); |