[svn:parrot] r39567 - trunk/t/examples
coke at svn.parrot.org
coke at svn.parrot.org
Mon Jun 15 01:17:58 UTC 2009
Author: coke
Date: Mon Jun 15 01:17:57 2009
New Revision: 39567
URL: https://trac.parrot.org/parrot/changeset/39567
Log:
Instead of spewing stderr to the screen, save it, and verify that it's 0.
This has the benefit of hiding the output for all TODO'd tests, but
showing the error for those expected to pass.
BTW - when I run this, 3 of the sample PIR files are segfaulting; they
should be hunted down and fixed.
Modified:
trunk/t/examples/pod.t
Modified: trunk/t/examples/pod.t
==============================================================================
--- trunk/t/examples/pod.t Mon Jun 15 00:41:52 2009 (r39566)
+++ trunk/t/examples/pod.t Mon Jun 15 01:17:57 2009 (r39567)
@@ -39,7 +39,7 @@
$snippet->{code} . "\n.end";
}
- # Generate a temp file we can compile.
+ # Generate a temp file for the source.
my ($fh,$tempfile) = tempfile(
SUFFIX => '.' . lc $snippet->{type},
UNLINK => 1
@@ -47,21 +47,38 @@
print {$fh} $snippet->{code};
close $fh;
+ # Generate a temp file for stderr
+ my ($err_fh,$err_tempfile) = tempfile(
+ SUFFIX => '.err',
+ UNLINK => 1
+ );
+ close $err_fh;
+
# Send the output to /dev/null; similar to perl5's -c
my $cmd = File::Spec->curdir() . $PConfig{slash} .
$PConfig{test_prog} . " -o " . File::Spec->devnull() . " " .
- $tempfile;
-
+ $tempfile . ' 2> ' . $err_tempfile;
+
my $description = join (':', map {$snippet->{$_}}
qw(file line type modifier));
+ my $rc = system($cmd);
+ open my $errout_fh, '<', $err_tempfile;
+
+ my $error_output;
+ {
+ undef local $/;
+ $error_output = <$errout_fh>;
+ }
+
+ my $todo = 0;
+ $todo = 1 if ($snippet->{modifier} =~ /TODO|INVALID/);
TODO: {
# conditionally TODO the file.
- local $TODO = "invalid code" if $snippet->{modifier} =~
- /TODO|INVALID/;
- is(system($cmd), 0 , $description);
- }
+ local $TODO = 'invalid code' if $todo;
+ is ($error_output,'',$description);
+ }
}
sub get_samples {
More information about the parrot-commits
mailing list