Author: allison
Date: Mon Dec 29 22:57:00 2008
New Revision: 34619
Modified:
branches/pdd22io_part3/t/pmc/stringhandle.t
Log:
[pdd22io] Add tests for 'read', 'print', and 'close' opcodes on StringHandle.
Modified: branches/pdd22io_part3/t/pmc/stringhandle.t
==============================================================================
--- branches/pdd22io_part3/t/pmc/stringhandle.t (original)
+++ branches/pdd22io_part3/t/pmc/stringhandle.t Mon Dec 29 22:57:00 2008
@@ -7,9 +7,7 @@
use lib qw( . lib ../lib ../../lib );
use Test::More;
-use Parrot::Test tests => 17;
-use Parrot::Test::Util 'create_tempfile';
-use Parrot::Test::Util 'create_tempfile';
+use Parrot::Test tests => 18;
=head1 NAME
@@ -135,6 +133,34 @@
ok 2 - $S0 = $P1.read($I2) # again on same stream
OUT
+pir_output_is(
+ <<'CODE', <<'OUT', 'read opcode' );
+.sub 'test' :main
+ $P0 = new 'StringHandle'
+ $P0.'open'('README', 'w')
+
+ print $P0, "This is Parrot, version"
+ close $P0
+
+ $P0.'open'('README')
+
+ $S0 = read $P0, 14 # bytes
+ if $S0 == 'This is Parrot' goto ok_1
+ print 'not '
+ ok_1:
+ say 'ok 1 - $S0 = read $P1, $I2'
+
+ $S0 = read $P0, 9 # bytes
+ if $S0 == ', version' goto ok_2
+ print 'not '
+ ok_2:
+ say 'ok 2 - $S0 = read $P1, $I2 # again on same stream'
+.end
+CODE
+ok 1 - $S0 = read $P1, $I2
+ok 2 - $S0 = read $P1, $I2 # again on same stream
+OUT
+
# L<PDD22/I\/O PMC API/=item print>
pir_output_is( <<"CODE", <<'OUT', 'print - synchronous' );
.sub 'test' :main