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

NotFound at svn.parrot.org NotFound at svn.parrot.org
Tue Aug 24 12:40:54 UTC 2010


Author: NotFound
Date: Tue Aug 24 12:40:53 2010
New Revision: 48621
URL: https://trac.parrot.org/parrot/changeset/48621

Log:
more tests for Exception clone

Modified:
   trunk/t/pmc/exception.t

Modified: trunk/t/pmc/exception.t
==============================================================================
--- trunk/t/pmc/exception.t	Tue Aug 24 12:07:06 2010	(r48620)
+++ trunk/t/pmc/exception.t	Tue Aug 24 12:40:53 2010	(r48621)
@@ -20,7 +20,7 @@
 
 .sub main :main
     .include 'test_more.pir'
-    plan(22)
+    plan(24)
     test_bool()
     test_int()
     test_attrs()
@@ -176,6 +176,8 @@
     ok(1,'caught exception object thrown')
 .end
 
+# Test clone vtable function
+# TT #1446 - need more tests
 .sub test_throw_clone
     .local pmc ex, exclone, eh, ehguard
     .local int result
@@ -195,11 +197,37 @@
     result = 0
     push_eh eh
     throw exclone
+    goto catchall
   catch:
     result = 1
   catchall:
-    # TT #1446 - need more tests
+    finalize eh
+    finalize ehguard
     is(result, 1, 'caught a cloned Exception')
+
+    null exclone
+    result = 0
+    .local pmc pay, getpay, exc
+    set_label ehguard, catchall2
+    set_label eh, catch2
+
+    pay = new ['Integer'], 9875
+    ex['payload'] = pay
+    exclone = clone ex
+    result = iseq ex, exclone
+    is(result, 1, 'cloned Exception with payload is equal to original')
+
+    result = 0
+    throw exclone
+    goto catchall2
+  catch2:
+    .get_results(exc)
+    getpay = exc['payload']
+    $I0 = getpay
+    if $I0 != 9875 goto catchall2
+    result = 1
+  catchall2:
+    is(result, 1, 'caught a cloned Exception with payload')
 .end
 
 # Local Variables:


More information about the parrot-commits mailing list