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

plobsing at svn.parrot.org plobsing at svn.parrot.org
Tue Jun 8 06:31:44 UTC 2010


Author: plobsing
Date: Tue Jun  8 06:31:44 2010
New Revision: 47452
URL: https://trac.parrot.org/parrot/changeset/47452

Log:
move stat test to dynop tests and avoid getstderr dynop in another test

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 06:03:03 2010	(r47451)
+++ trunk/t/dynoplibs/io.t	Tue Jun  8 06:31:44 2010	(r47452)
@@ -16,7 +16,7 @@
 
 =cut
 
-.const int TESTS = 11
+.const int TESTS = 12
 
 .loadlib 'io_ops'
 
@@ -32,6 +32,7 @@
     open_pipe_for_reading()
     getfd_fdopen()
     printerr_tests()
+    stat_tests()
 
     # must come after (these don't use test_more)
     open_pipe_for_writing()
@@ -159,7 +160,7 @@
     pipe = open command, 'wp'
     unless pipe goto open_pipe_for_writing_failed
 
-    pipe.'puts'("ok 8 - open pipe for writing\n")
+    pipe.'puts'("ok 9 - open pipe for writing\n")
     close pipe
     .return ()
 
@@ -203,7 +204,7 @@
     print "not "
 
 _readline_handler:
-        print "ok 9\n"
+        print "ok 10\n"
         pop_eh
 
     push_eh _read_handler
@@ -211,7 +212,7 @@
     print "not "
 
 _read_handler:
-        print "ok 10\n"
+        print "ok 11\n"
         pop_eh
 
     push_eh _print_handler
@@ -219,7 +220,7 @@
     print "not "
 
 _print_handler:
-        print "ok 11\n"
+        print "ok 12\n"
         pop_eh
 .end
 
@@ -253,6 +254,22 @@
 OUTPUT
 .end
 
+.sub 'stat_tests'
+    .local pmc pio
+    .local int len
+    .const string description = 'stat failed'
+    .include "stat.pasm"
+  push_eh eh
+    len = stat 'no_such_file', .STAT_FILESIZE
+    ok(0, description)
+    goto ret
+  eh:
+    ok(1, description)
+  ret:
+    pop_eh
+    .return ()
+.end
+
 .namespace ["Testing"]
 
 .sub open :method

Modified: trunk/t/pmc/io.t
==============================================================================
--- trunk/t/pmc/io.t	Tue Jun  8 06:03:03 2010	(r47451)
+++ trunk/t/pmc/io.t	Tue Jun  8 06:31:44 2010	(r47452)
@@ -7,7 +7,7 @@
 use lib qw( . lib ../lib ../../lib );
 
 use Test::More;
-use Parrot::Test tests => 37;
+use Parrot::Test tests => 36;
 use Parrot::Test::Util 'create_tempfile';
 use Parrot::Test::Util 'create_tempfile';
 
@@ -449,16 +449,23 @@
 OUTPUT
 
 pasm_output_is( <<'CODE', <<'OUTPUT', 'callmethod puts' );
-.loadlib 'io_ops'
-   getstderr P2    # the object
-   set S0, "puts"    # method
-   set S5, "ok 1\n"    # 2nd param
-   set_args "0,0", P2, S5
-   callmethodcc P2, S0
-   set S5, "ok 2\n"
-   set_args "0,0", P2, S5
-   callmethodcc P2, S0
-   end
+.include 'stdio.pasm'
+    getinterp P0                 # invocant
+    set I0, .PIO_STDERR_FILENO   # 1st argument
+    set_args "0,0", P0, I0
+    callmethodcc P0, "stdhandle"
+    get_results "0", P2          # STDERR
+
+    set S0, "puts"               # method
+    set S5, "ok 1\n"             # 2nd param
+    set_args "0,0", P2, S5
+    callmethodcc P2, S0
+
+    set S5, "ok 2\n"
+    set_args "0,0", P2, S5
+    callmethodcc P2, S0
+
+    end
 CODE
 ok 1
 ok 2
@@ -760,21 +767,6 @@
 ok
 OUTPUT
 
-pir_error_output_like( <<'CODE', <<"OUTPUT", "stat failed" );
-.loadlib 'io_ops'
-.sub main :main
-    .local pmc pio
-    .local int len
-    .include "stat.pasm"
-    .local string f
-    f = 'no_such_file'
-    len = stat f, .STAT_FILESIZE
-    print "never\n"
-.end
-CODE
-/stat failed:/
-OUTPUT
-
 # Local Variables:
 #   mode: cperl
 #   cperl-indent-level: 4


More information about the parrot-commits mailing list