tagged release 0.7.1
[parrot.git] / languages / perl6 / t / 02-test-pm / 3-output.t
blob7184010c14994ec056e6fa22c32d4dd1288c70b1
1 # this test tests that the output (text output and return code) of
2 # test scripts are correct.
4 use v6;
5 use Test;
7 plan 1;
9 skip_rest("skipping because redirection is not portable"); exit;
11 # this test tests that various failure conditions (that we don't want
12 # to show up as failures) happen, and test the the output of the test
13 # suite is correct.
15 # ... copied from t/run/05-unknown-option.t, but it looks wrong :)
16 sub nonce () { return (".$*PID." ~ int rand 1000) }
17 my $out_fn = "temp-ex-output" ~ nonce;
18 my $redir_pre = "2>&1 >";
19 my $redir_post = "2>&1";
20 if $*OS eq any <MSWin32 mingw msys cygwin> {
21     $redir_pre = ">";
22     $redir_post = "";
25 my $file = $?FILE;
26 $file ~~ s:P5/output.t/script.pl/;
27 my $cmd = "$*EXECUTABLE_NAME $file $redir_pre $out_fn $redir_post";
28 %*ENV<TEST_ALWAYS_CALLER> = 0;
30 diag($cmd);
31 system($cmd);
33 my $output = slurp $out_fn;
34 unlink($out_fn);
36 is($output, "1..1
37 ok 1 - TODO that passes # TODO
38 # Looks like 1 tests of 1 passed unexpectedly
39 ", "got correct output");