X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Fop%2Fexec.t;h=5f110be32e1b9738e020782001465b152a0a08ab;hb=e24631be6ac297b562086a055de17c5bd4247797;hp=271570fcd578fdd2856a7de4ffda358ac5a4373b;hpb=b6345914e6a5bcc0fcf2c030fb88a31b5c80a120;p=p5sagit%2Fp5-mst-13.2.git diff --git a/t/op/exec.t b/t/op/exec.t index 271570f..5f110be 100755 --- a/t/op/exec.t +++ b/t/op/exec.t @@ -14,9 +14,12 @@ $| = 1; # flush stdout $ENV{LC_ALL} = 'C'; # Forge English error messages. $ENV{LANGUAGE} = 'C'; # Ditto in GNU. -my $Is_VMS = $^O eq 'VMS'; +my $Is_VMS = $^O eq 'VMS'; +my $Is_Win32 = $^O eq 'MSWin32'; -plan(tests => 20); +skip_all("Tests mostly usesless on MacOS") if $^O eq 'MacOS'; + +plan(tests => 21); my $Perl = which_perl(); @@ -35,9 +38,9 @@ $exit = system qq{$Perl -le "print q{ok $tnum - split & direct system(EXPR)"}}; next_test(); is( $exit, 0, ' exited 0' ); -# On VMS you need the quotes around the program or it won't work. +# On VMS and Win32 you need the quotes around the program or it won't work. # On Unix its the opposite. -my $quote = $Is_VMS ? '"' : ''; +my $quote = $Is_VMS || $Is_Win32 ? '"' : ''; $tnum = curr_test(); $exit = system $Perl, '-le', "${quote}print q{ok $tnum - system(PROG, LIST)}${quote}"; @@ -71,6 +74,12 @@ is( $echo_out, "ok\n", 'piped echo emulation'); is( scalar `$Perl -le "print 'ok'" | $Perl -e "print "`, "ok\n", 'extra newlines on outgoing pipes'); + + { + local($/) = \2; + $out = runperl(prog => 'print q{1234}'); + is($out, "1234", 'ignore $/ when capturing output in scalar context'); + } } @@ -80,9 +89,8 @@ my $exit_one = $Is_VMS ? 4 << 8 : 1 << 8; is( system(qq{$Perl "-I../lib" -e "use vmsish qw(hushed); exit 1"}), $exit_one, 'Explicit exit of 1' ); - -$rc = system "lskdfj"; -unless( ok($rc == 255 << 8 or $rc == -1 or $rc == 256) ) { +$rc = system { "lskdfj" } "lskdfj"; +unless( ok($rc == 255 << 8 or $rc == -1 or $rc == 256 or $rc == 512) ) { print "# \$rc == $rc\n"; } @@ -102,8 +110,9 @@ END TODO: { my $tnum = curr_test(); if( $^O =~ /Win32/ ) { - print "not ok $tnum - exec failure doesn't terminate process # TODO Win32 exec failure waits for user input\n"; - next_test; + print "not ok $tnum - exec failure doesn't terminate process " . + "# TODO Win32 exec failure waits for user input\n"; + next_test(); last TODO; }