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

NotFound at svn.parrot.org NotFound at svn.parrot.org
Sun Jun 20 08:48:47 UTC 2010


Author: NotFound
Date: Sun Jun 20 08:48:46 2010
New Revision: 47721
URL: https://trac.parrot.org/parrot/changeset/47721

Log:
fix and enhance ArrayIterator test for backwards out of bounds

Modified:
   trunk/t/pmc/arrayiterator.t

Modified: trunk/t/pmc/arrayiterator.t
==============================================================================
--- trunk/t/pmc/arrayiterator.t	Sun Jun 20 08:47:54 2010	(r47720)
+++ trunk/t/pmc/arrayiterator.t	Sun Jun 20 08:48:46 2010	(r47721)
@@ -108,13 +108,39 @@
     nok(it, "Iterator is finished after second shift")
     is($P0, 1, "2nd element has correct value")
 
-    $I0 = 1
-    push_eh fail
-    $P0 = shift it
-    $I0 = 0
+    .local int result
+    .local pmc ehandler
+    result = 0
+    ehandler = new ['ExceptionHandler']
+    ehandler.'handle_types'(.EXCEPTION_OUT_OF_BOUNDS)
+    push_eh ehandler
+
+    set_addr ehandler, handlep
+    $P0 = pop it
+    goto fail
+handlep:
+    finalize ehandler
+    set_addr ehandler, handlei
+    $I0 = pop it
+    goto fail
+handlei:
+    finalize ehandler
+    set_addr ehandler, handlen
+    $N0 = pop it
+    goto fail
+handlen:
+    finalize ehandler
+    set_addr ehandler, handles
+    $S0 = pop it
+    goto fail
+handles:
+    finalize ehandler
+
+    result = 1
   fail:
     pop_eh
-    ok($I0, "Shifting from finished iterator throws exception")
+    ok(result, "pop from finished iterator throws out of bounds exception")
+
 .end
 
 .sub 'iterate_backward_string'


More information about the parrot-commits mailing list