[svn:parrot] r47949 - trunk/t/pmc

NotFound at svn.parrot.org NotFound at svn.parrot.org
Thu Jul 1 20:47:30 UTC 2010


Author: NotFound
Date: Thu Jul  1 20:47:29 2010
New Revision: 47949
URL: https://trac.parrot.org/parrot/changeset/47949

Log:
test for FileHandle.readall failure conditions

Modified:
   trunk/t/pmc/filehandle.t

Modified: trunk/t/pmc/filehandle.t
==============================================================================
--- trunk/t/pmc/filehandle.t	Thu Jul  1 03:40:00 2010	(r47948)
+++ trunk/t/pmc/filehandle.t	Thu Jul  1 20:47:29 2010	(r47949)
@@ -7,7 +7,7 @@
 use lib qw( . lib ../lib ../../lib );
 
 use Test::More;
-use Parrot::Test tests => 22;
+use Parrot::Test tests => 23;
 use Parrot::Test::Util 'create_tempfile';
 use Parrot::Test::Util 'create_tempfile';
 
@@ -635,6 +635,39 @@
 ok
 OUTPUT
 
+pir_output_is( <<'CODE', <<'OUTPUT', "readall - failure conditions" );
+.include 'except_types.pasm'
+.sub main :main
+    .local pmc fh, eh
+    fh = new ['FileHandle']
+    eh = new ['ExceptionHandler']
+    eh.'handle_types'(.EXCEPTION_PIO_ERROR)
+    set_addr eh, catch1
+    push_eh eh
+    # Using unopened FileHandle
+    fh.'readall'()
+    say 'should never happen'
+    goto test2
+  catch1:
+    finalize eh
+    say 'caught unopened'
+  test2:
+    set_addr eh, catch2
+    fh.'open'('README')
+    # Using opened FileHandle with the filepath option
+    fh.'readall'('README')
+    say 'should never happen'
+    goto end
+  catch2:
+    finalize eh
+    say 'caught reopen'
+  end:
+.end
+CODE
+caught unopened
+caught reopen
+OUTPUT
+
 pir_output_is( <<"CODE", <<"OUTPUT", "readall() - utf8 on closed filehandle" );
 .sub 'main'
     .local pmc ifh


More information about the parrot-commits mailing list