Skip to content

Commit

Permalink
test for FileHandle.readall failure conditions
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.parrot.org/parrot/trunk@47949 d31e2699-5ff4-0310-a27c-f18f2fbe73fe
  • Loading branch information
NotFound authored and NotFound committed Jul 1, 2010
1 parent 626287e commit 6aed0cf
Showing 1 changed file with 34 additions and 1 deletion.
35 changes: 34 additions & 1 deletion t/pmc/filehandle.t
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 6aed0cf

Please sign in to comment.