Author: jkeenan
Date: Wed Dec 10 18:46:49 2008
New Revision: 33786
Modified:
branches/testparrottest/t/perl/Parrot_Test.t
Log:
Add tests for effects of $ENV{POSTMORTEM}.
Modified: branches/testparrottest/t/perl/Parrot_Test.t
==============================================================================
--- branches/testparrottest/t/perl/Parrot_Test.t (original)
+++ branches/testparrottest/t/perl/Parrot_Test.t Wed Dec 10 18:46:49 2008
@@ -33,7 +33,7 @@
plan( skip_all => "Test::Builder::Tester not installed\n" );
exit 0;
}
- plan( tests => 116 );
+ plan( tests => 120 );
}
use lib qw( . lib ../lib ../../lib );
@@ -632,7 +632,9 @@
test_test($desc);
}
+my $outfile = File::Spec->catfile( qw| t perl Parrot_Test_1.out | );
{
+ unlink $outfile;
local $ENV{POSTMORTEM} = 1;
$desc = 'pir_output_is: success';
test_out("ok 1 - $desc");
@@ -644,7 +646,28 @@
foo
OUTPUT
test_test($desc);
-
+ ok( -f $outfile,
+ "file created during test preserved due to \$ENV{POSTMORTEM}");
+ unlink $outfile;
+ ok( ! -f $outfile,
+ "file created during test has been deleted");
+}
+
+{
+ unlink $outfile;
+ local $ENV{POSTMORTEM} = 0;
+ $desc = 'pir_output_is: success';
+ test_out("ok 1 - $desc");
+ pir_output_is( <<'CODE', <<'OUTPUT', $desc );
+.sub 'test' :main
+ print "foo\n"
+.end
+CODE
+foo
+OUTPUT
+ test_test($desc);
+ ok( ! -f $outfile,
+ "file created during test was not retained");
}