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

NotFound at svn.parrot.org NotFound at svn.parrot.org
Tue Aug 31 22:31:12 UTC 2010


Author: NotFound
Date: Tue Aug 31 22:31:12 2010
New Revision: 48739
URL: https://trac.parrot.org/parrot/changeset/48739

Log:
some more StringIterator tests

Modified:
   trunk/t/pmc/stringiterator.t

Modified: trunk/t/pmc/stringiterator.t
==============================================================================
--- trunk/t/pmc/stringiterator.t	Tue Aug 31 21:48:11 2010	(r48738)
+++ trunk/t/pmc/stringiterator.t	Tue Aug 31 22:31:12 2010	(r48739)
@@ -17,11 +17,12 @@
 =cut
 
 .include 'iterator.pasm'
+.include 'except_types.pasm'
 
 .sub main :main
     .include 'test_more.pir'
 
-    plan(24)
+    plan(28)
 
     test_clone()
     test_elements()
@@ -29,6 +30,7 @@
     iterate_backward() # 8 tests
     iterate_wrong() # 1 test
     iterate_out() # 1 test
+    get_keyed()
 
 .end
 
@@ -208,6 +210,44 @@
 end:
 .end
 
+.sub get_keyed
+    .local pmc s, it, eh
+    .local string s1
+    .local int result, i1
+    result = 0
+    s = new ['String']
+    s = 'hi'
+    it = iter s
+    s1 = it[0]
+    is(s1, 'h', 'get_string_keyed_int')
+
+    eh = new ['ExceptionHandler']
+    eh.'handle_types'(.EXCEPTION_OUT_OF_BOUNDS)
+    set_label eh, catch
+    push_eh eh
+    s1 = it[2]
+    goto done
+  catch:
+    finalize eh
+    result = 1
+  done:
+    ok(result, 'get_string_keyed_int out of bounds')
+
+    result = 0
+    i1 = it[0]
+    s1 = chr i1
+    is(s1, 'h', 'get_integer_keyed_int')
+
+    set_label eh, catch2
+    i1 = it[2]
+    goto done2
+  catch2:
+    finalize eh
+    result = 1
+  done2:
+    ok(result, 'get_integer_keyed_int out of bounds')
+.end
+
 # Local Variables:
 #   mode: pir
 #   fill-column: 100


More information about the parrot-commits mailing list