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

NotFound at svn.parrot.org NotFound at svn.parrot.org
Thu Aug 26 13:10:45 UTC 2010


Author: NotFound
Date: Thu Aug 26 13:10:45 2010
New Revision: 48668
URL: https://trac.parrot.org/parrot/changeset/48668

Log:
some more Exception tests

Modified:
   trunk/t/pmc/exception.t

Modified: trunk/t/pmc/exception.t
==============================================================================
--- trunk/t/pmc/exception.t	Thu Aug 26 13:09:12 2010	(r48667)
+++ trunk/t/pmc/exception.t	Thu Aug 26 13:10:45 2010	(r48668)
@@ -20,9 +20,10 @@
 
 .sub main :main
     .include 'test_more.pir'
-    plan(23)
+    plan(27)
     test_bool()
     test_int()
+    test_get_integer_keyed()
     test_attrs()
     test_attributes()
     test_push_pop_eh()
@@ -45,6 +46,30 @@
     is($I0, 42, 'set/get integer on Exception')
 .end
 
+.sub test_get_integer_keyed
+    .local pmc ex, eh
+    .local int value
+    ex = new ['Exception']
+    value = ex['type']
+    is(value, 0, 'get type default value')
+    value = ex['exit_code']
+    is(value, 0, 'get exit_code default value')
+    value = ex['handled']
+    is(value, 0, 'get handled default is false')
+
+    eh = new ['ExceptionHandler']
+    eh.'handle_types'(.EXCEPTION_ATTRIB_NOT_FOUND)
+    set_label eh, catch
+    push_eh eh
+    value = 1
+    value = ex['the droids you are looking for']
+    value = 0
+  catch:
+    finalize eh
+    pop_eh
+    is(value, 1, 'invalid key throws')
+.end
+
 .sub test_attrs
     $P0 = new 'ExceptionHandler'
     set_addr $P0, _handler


More information about the parrot-commits mailing list