[svn:parrot] r47451 - in trunk: src/pmc t/pmc
plobsing at svn.parrot.org
plobsing at svn.parrot.org
Tue Jun 8 06:03:03 UTC 2010
Author: plobsing
Date: Tue Jun 8 06:03:03 2010
New Revision: 47451
URL: https://trac.parrot.org/parrot/changeset/47451
Log:
more io coretest dynop => method conversion
also fix FileHandle.seek identified as wrongly implemented by a converted test
Modified:
trunk/src/pmc/filehandle.pmc
trunk/t/pmc/io.t
Modified: trunk/src/pmc/filehandle.pmc
==============================================================================
--- trunk/src/pmc/filehandle.pmc Tue Jun 8 05:33:16 2010 (r47450)
+++ trunk/src/pmc/filehandle.pmc Tue Jun 8 06:03:03 2010 (r47451)
@@ -736,11 +736,12 @@
*/
- METHOD seek(INTVAL whence, INTVAL offs, INTVAL offs_overflow :optional) {
- const PIOOFF_T pio_offs = offs_overflow ?
+ METHOD seek(INTVAL whence, INTVAL offs, INTVAL offs_overflow :optional,
+ int has_overflow :opt_flag) {
+ const PIOOFF_T pio_offs = has_overflow ?
Parrot_io_make_offset32(offs_overflow, offs) :
offs;
- if (Parrot_io_seek(INTERP, SELF, pio_offs, whence))
+ if (0 > Parrot_io_seek(INTERP, SELF, pio_offs, whence))
Parrot_ex_throw_from_c_args(INTERP, NULL, EXCEPTION_PIO_ERROR, "seek failed");
}
Modified: trunk/t/pmc/io.t
==============================================================================
--- trunk/t/pmc/io.t Tue Jun 8 05:33:16 2010 (r47450)
+++ trunk/t/pmc/io.t Tue Jun 8 06:03:03 2010 (r47451)
@@ -7,7 +7,7 @@
use lib qw( . lib ../lib ../../lib );
use Test::More;
-use Parrot::Test tests => 38;
+use Parrot::Test tests => 37;
use Parrot::Test::Util 'create_tempfile';
use Parrot::Test::Util 'create_tempfile';
@@ -411,25 +411,6 @@
ok 3
OUT
-pasm_output_is( <<'CODE', <<'OUTPUT', 'printerr op' );
-.loadlib 'io_ops'
- new P0, ['String']
- set P0, "This is a test\n"
- printerr 10
- printerr "\n"
- printerr 1.0
- printerr "\n"
- printerr "foo"
- printerr "\n"
- printerr P0
- end
-CODE
-10
-1
-foo
-This is a test
-OUTPUT
-
pir_output_is( <<'CODE', <<'OUTPUT', 'puts method' );
.include 'stdio.pasm'
.sub main :main
@@ -483,20 +464,24 @@
ok 2
OUTPUT
-pasm_output_is( <<"CODE", <<'OUTPUT', 'seek/tell' );
-.loadlib 'io_ops'
- open P0, "$temp_file", 'w'
- print P0, "Hello "
- tell I0, P0
- print P0, "World!"
- seek P0, I0, 0
- print P0, "Parrot!\\n"
- close P0
- say "ok 1"
- open P0, "$temp_file", 'r'
- read S0, P0, 65635
- print S0
- end
+pir_output_is( sprintf(<<'CODE', $temp_file), <<'OUTPUT', 'seek/tell' );
+.const string temp_file = '%s'
+.sub 'main' :main
+ $P0 = new ['FileHandle']
+
+ $P0.'open'(temp_file, 'w')
+ $P0.'print'("Hello ")
+ $I0 = $P0.'tell'()
+ $P0.'print'("World!")
+ $P0.'seek'(0, $I0)
+ $P0.'print'("Parrot!\n")
+ $P0.'close'()
+ say "ok 1"
+
+ $P0.'open'(temp_file, 'r')
+ $S0 = $P0.'read'(65635)
+ print $S0
+.end
CODE
ok 1
Hello Parrot!
More information about the parrot-commits
mailing list