[svn:parrot] r41587 - trunk/t/pmc

dukeleto at svn.parrot.org dukeleto at svn.parrot.org
Thu Oct 1 08:09:40 UTC 2009


Author: dukeleto
Date: Thu Oct  1 08:09:36 2009
New Revision: 41587
URL: https://trac.parrot.org/parrot/changeset/41587

Log:
[t] Convert some exception tests

Modified:
   trunk/t/pmc/exception-old.t
   trunk/t/pmc/exception.t

Modified: trunk/t/pmc/exception-old.t
==============================================================================
--- trunk/t/pmc/exception-old.t	Thu Oct  1 01:28:48 2009	(r41586)
+++ trunk/t/pmc/exception-old.t	Thu Oct  1 08:09:36 2009	(r41587)
@@ -6,7 +6,7 @@
 use warnings;
 use lib qw( . lib ../lib ../../lib );
 use Test::More;
-use Parrot::Test tests => 32;
+use Parrot::Test tests => 30;
 
 =head1 NAME
 
@@ -22,39 +22,6 @@
 
 =cut
 
-pir_output_is( <<'CODE', <<'OUTPUT', "push_eh - pop_eh, PMC exception handler" );
-.sub main :main
-    $P0 = new ['ExceptionHandler']
-    set_addr $P0, _handler
-    push_eh $P0
-    print "ok 1\n"
-    pop_eh
-    print "ok 2\n"
-    end
-_handler:
-    print "caught it\n"
-    end
-.end
-CODE
-ok 1
-ok 2
-OUTPUT
-
-pasm_output_is( <<'CODE', <<'OUTPUT', "push_eh - throw" );
-    print "main\n"
-    push_eh _handler
-    new P30, ['Exception']
-    throw P30
-    print "not reached\n"
-    end
-_handler:
-    print "caught it\n"
-    end
-CODE
-main
-caught it
-OUTPUT
-
 pasm_output_is( <<'CODE', <<'OUTPUT', "push_eh - throw, PMC exception handler" );
     print "main\n"
     new P20, ['ExceptionHandler']

Modified: trunk/t/pmc/exception.t
==============================================================================
--- trunk/t/pmc/exception.t	Thu Oct  1 01:28:48 2009	(r41586)
+++ trunk/t/pmc/exception.t	Thu Oct  1 08:09:36 2009	(r41587)
@@ -18,11 +18,13 @@
 
 .sub main :main
     .include 'test_more.pir'
-    plan( 9 )
+    plan( 12 )
     test_bool()
     test_int()
     test_attrs()
     test_push_pop_eh()
+    test_push_pop_eh_long()
+    test_push_eh_throw()
 .end
 
 .sub test_push_pop_eh
@@ -37,6 +39,30 @@
     say "i am the decider"
 .end
 
+.sub test_push_eh_throw
+    push_eh handler
+    $P0 = new ['Exception']
+    throw $P0
+    ok(0,'throw does not throw')
+
+  handler:
+    ok(1,'throw can throw')
+.end
+
+.sub test_push_pop_eh_long
+    $P0 = new ['ExceptionHandler']
+    set_addr $P0, handler
+    push_eh $P0
+    ok(1,'push_eh works (long)')
+
+    pop_eh
+    ok(1,'pop_eh works (long)')
+    .return()
+
+  handler:
+    say "i am the decider"
+.end
+
 .sub test_bool
     $P0 = new 'ExceptionHandler'
     set_addr $P0, _handler


More information about the parrot-commits mailing list