develooper Front page | perl.cvs.parrot | Postings from December 2008

[svn:parrot] r33786 - branches/testparrottest/t/perl

From:
jkeenan
Date:
December 10, 2008 18:46
Subject:
[svn:parrot] r33786 - branches/testparrottest/t/perl
Message ID:
20081211024651.A173ACBA89@x12.develooper.com
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");
 }
 
 



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About