Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

test for FileHandle.readall failure conditions

git-svn-id: https://svn.parrot.org/parrot/trunk@47949 d31e2699-5ff4-0310-a27c-f18f2fbe73fe
  • Loading branch information...
commit 6aed0cffe10b94df0e46e2a5c40908146b69f355 1 parent 626287e
NotFound authored
Showing with 34 additions and 1 deletion.
  1. +34 −1 t/pmc/filehandle.t
View
35 t/pmc/filehandle.t
@@ -7,7 +7,7 @@ use warnings;
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 @@ CODE
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
Please sign in to comment.
Something went wrong with that request. Please try again.