[svn:parrot] r47447 - in trunk/t: dynoplibs pmc

plobsing at svn.parrot.org plobsing at svn.parrot.org
Tue Jun 8 04:16:13 UTC 2010


Author: plobsing
Date: Tue Jun  8 04:16:13 2010
New Revision: 47447
URL: https://trac.parrot.org/parrot/changeset/47447

Log:
avoid dynop use in 1 io test, move another to dynop tests.
also fix io dynops tests (closing stdout is NOT COOL!)

Modified:
   trunk/t/dynoplibs/io.t
   trunk/t/pmc/io.t

Modified: trunk/t/dynoplibs/io.t
==============================================================================
--- trunk/t/dynoplibs/io.t	Tue Jun  8 03:56:59 2010	(r47446)
+++ trunk/t/dynoplibs/io.t	Tue Jun  8 04:16:13 2010	(r47447)
@@ -16,7 +16,7 @@
 
 =cut
 
-.const int TESTS = 6
+.const int TESTS = 10
 
 .loadlib 'io_ops'
 
@@ -31,7 +31,10 @@
     open_null_mode()
     open_pipe_for_reading()
     getfd_fdopen()
-    open_pipe_for_writing() # must be last (doesn't use test_more)
+
+    # must come after (these don't use test_more)
+    open_pipe_for_writing()
+    read_invalid_fh()
 .end
 
 .sub open_delegates_to_filehandle_pmc
@@ -155,7 +158,7 @@
     pipe = open command, 'wp'
     unless pipe goto open_pipe_for_writing_failed
 
-    pipe.'puts'("ok 5 - open pipe for writing\n")
+    pipe.'puts'("ok 7 - open pipe for writing\n")
     close pipe
     .return ()
 
@@ -174,13 +177,6 @@
     $I0 = $P0.'get_fd'()
     fdopen $P1, $I0, 'w'
     $I0 = defined $P1
-    ok($I0, 'get_fd()/fdopen')
-    close $P1
-
-    getstdout $P0
-    $I0 = $P0.'get_fd'()
-    fdopen $P1, $I0, 'w'
-    $I0 = defined $P1
     ok($I0, 'fdopen - no close')
 .end
 
@@ -198,6 +194,34 @@
     .return ()
 .end
 
+.sub 'read_invalid_fh'
+    $P0 = new ['FileHandle']
+
+    push_eh _readline_handler
+    $S0 = readline $P0
+    print "not "
+
+_readline_handler:
+        print "ok 8\n"
+        pop_eh
+
+    push_eh _read_handler
+    $S0 = read $P0, 1
+    print "not "
+
+_read_handler:
+        print "ok 9\n"
+        pop_eh
+
+    push_eh _print_handler
+    print $P0, "kill me now\n"
+    print "not "
+
+_print_handler:
+        print "ok 10\n"
+        pop_eh
+.end
+
 .namespace ["Testing"]
 
 .sub open :method

Modified: trunk/t/pmc/io.t
==============================================================================
--- trunk/t/pmc/io.t	Tue Jun  8 03:56:59 2010	(r47446)
+++ trunk/t/pmc/io.t	Tue Jun  8 04:16:13 2010	(r47447)
@@ -7,7 +7,7 @@
 use lib qw( . lib ../lib ../../lib );
 
 use Test::More;
-use Parrot::Test tests => 39;
+use Parrot::Test tests => 38;
 use Parrot::Test::Util 'create_tempfile';
 use Parrot::Test::Util 'create_tempfile';
 
@@ -41,13 +41,13 @@
 
 my (undef, $temp_file) = create_tempfile( UNLINK => 1 );
 
-pir_output_is( sprintf(<<'CODE', $temp_file), <<'OUTPUT', "timely destruction (ops)");
-.loadlib 'io_ops'
+pir_output_is( sprintf(<<'CODE', $temp_file), <<'OUTPUT', "timely destruction", todo => 'TT #1659');
 .const string temp_file = '%s'
 .sub main :main
     interpinfo $I0, 2    # GC mark runs
-    $P0 = open temp_file, 'w'
-        needs_destroy $P0
+    $P0 = new ['FileHandle']
+    $P0.'open'(temp_file, 'w')
+    needs_destroy $P0
     print $P0, "a line\n"
     null $P0            # kill it
     sweep 0            # a lazy GC has to close the PIO
@@ -59,42 +59,6 @@
 a line
 OUTPUT
 
-pir_output_is( <<'CODE', <<'OUTPUT', "read on invalid fh should throw exception (ops)" );
-.loadlib 'io_ops'
-.sub main :main
-    new $P0, ['FileHandle']
-
-    push_eh _readline_handler
-    $S0 = readline $P0
-    print "not "
-
-_readline_handler:
-        print "ok 1\n"
-        pop_eh
-
-    push_eh _read_handler
-    $S0 = read $P0, 1
-    print "not "
-
-_read_handler:
-        print "ok 2\n"
-        pop_eh
-
-    push_eh _print_handler
-    print $P0, "kill me now\n"
-    print "not "
-
-_print_handler:
-        print "ok 3\n"
-        pop_eh
-
-.end
-CODE
-ok 1
-ok 2
-ok 3
-OUTPUT
-
 pir_output_is( <<'CODE', <<'OUTPUT', "read on invalid fh should throw exception" );
 .sub main :main
     new $P0, ['FileHandle']


More information about the parrot-commits mailing list