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

NotFound at svn.parrot.org NotFound at svn.parrot.org
Tue Jun 22 15:31:33 UTC 2010


Author: NotFound
Date: Tue Jun 22 15:31:33 2010
New Revision: 47759
URL: https://trac.parrot.org/parrot/changeset/47759

Log:
test ExceptionHandler handle_types_except method

Modified:
   trunk/t/pmc/exceptionhandler.t

Modified: trunk/t/pmc/exceptionhandler.t
==============================================================================
--- trunk/t/pmc/exceptionhandler.t	Tue Jun 22 14:59:41 2010	(r47758)
+++ trunk/t/pmc/exceptionhandler.t	Tue Jun 22 15:31:33 2010	(r47759)
@@ -23,7 +23,7 @@
     .include 'test_more.pir'
 
     # If test exited with "bad plan" MyHandlerCan.can_handle wasn't invoked.
-    plan(9)
+    plan(11)
 
     .local pmc eh
     eh = new ['ExceptionHandler']
@@ -90,6 +90,8 @@
     pop_eh
     pop_eh
 
+    test_handle_types_except()
+
     goto subclass_handler
 
   typed_handler_one:
@@ -218,6 +220,54 @@
     .return(1)
 .end
 
+.namespace [ ]
+
+.sub 'test_handle_types_except'
+    .local pmc badeh, eh, ex
+    .local int i
+    .const int TYPEUSED = .EXCEPTION_UNEXPECTED_NULL
+    .const int TYPEOTHER = .EXCEPTION_SYNTAX_ERROR
+
+    i = 0
+    eh = new ['ExceptionHandler']
+    badeh = new ['ExceptionHandler']
+    eh.'handle_types_except'(TYPEUSED)
+    set_addr eh, catch
+    set_addr badeh, badcatch
+    push_eh badeh
+    push_eh eh
+    ex = new ['Exception']
+    ex['type'] = TYPEOTHER
+    throw ex
+    goto report1
+  badcatch:
+    finalize eh
+    goto report1
+  catch:
+    finalize eh
+    i = 1
+  report1:
+    ok(i, 'type not in except is list is caught')
+
+    i = 0
+    set_addr badeh, catchall
+    set_addr eh, dontcatch
+    ex = new ['Exception']
+    ex['type'] = TYPEUSED
+    throw ex
+    goto report2
+  catchall:
+    finalize eh
+    i = 1
+    goto report2
+  dontcatch:
+    finalize eh
+  report2:
+    pop_eh
+    pop_eh
+    ok(i, 'type in except is list is not caught')
+.end
+
 # Local Variables:
 #   mode: pir
 #   fill-column: 100


More information about the parrot-commits mailing list