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

NotFound at svn.parrot.org NotFound at svn.parrot.org
Fri Sep 3 06:22:36 UTC 2010


Author: NotFound
Date: Fri Sep  3 06:22:34 2010
New Revision: 48770
URL: https://trac.parrot.org/parrot/changeset/48770

Log:
test Exception get/set attribute handler_ctx

Modified:
   trunk/t/pmc/exception.t

Modified: trunk/t/pmc/exception.t
==============================================================================
--- trunk/t/pmc/exception.t	Fri Sep  3 00:23:13 2010	(r48769)
+++ trunk/t/pmc/exception.t	Fri Sep  3 06:22:34 2010	(r48770)
@@ -20,7 +20,7 @@
 
 .sub main :main
     .include 'test_more.pir'
-    plan(41)
+    plan(43)
     test_bool()
     test_int()
     test_integer_keyed()
@@ -29,6 +29,7 @@
     test_attributes()
     test_setattribute_wrong()
     test_birthtime()
+    test_handler_ctx()
     test_push_pop_eh()
     test_push_pop_eh_long()
     test_push_eh_throw()
@@ -243,6 +244,35 @@
     is(nbt, n, 'get and set birthtime')
 .end
 
+.sub test_handler_ctx
+    .local pmc ex, eh, hc
+    .local int result
+    ex = new ['Exception']
+    eh = new ['ExceptionHandler']
+    eh.'handle_types'(.EXCEPTION_INVALID_OPERATION)
+
+    result = 0
+    set_label eh, catch_get
+    push_eh eh
+    hc = getattribute ex, 'handler_ctx'
+    goto done_get
+  catch_get:
+    finalize eh
+    result = 1
+  done_get:
+    is(result, 1, 'get handler_ctx invalid operation')
+
+    result = 0
+    set_label eh, catch_set
+    setattribute ex, 'handler_ctx', ex
+    goto done_set
+  catch_set:
+    finalize eh
+    result = 1
+  done_set:
+    is(result, 1, 'set handler_ctx invalid operation')
+.end
+
 .sub test_push_pop_eh
     push_eh handler
     ok(1,'push_eh works')


More information about the parrot-commits mailing list