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

NotFound at svn.parrot.org NotFound at svn.parrot.org
Tue Jun 15 16:47:12 UTC 2010


Author: NotFound
Date: Tue Jun 15 16:47:12 2010
New Revision: 47642
URL: https://trac.parrot.org/parrot/changeset/47642

Log:
test for setting wrong direction in StringIterator

Modified:
   trunk/t/pmc/stringiterator.t

Modified: trunk/t/pmc/stringiterator.t
==============================================================================
--- trunk/t/pmc/stringiterator.t	Tue Jun 15 16:38:51 2010	(r47641)
+++ trunk/t/pmc/stringiterator.t	Tue Jun 15 16:47:12 2010	(r47642)
@@ -21,12 +21,13 @@
 .sub main :main
     .include 'test_more.pir'
 
-    plan(21)
+    plan(22)
 
     test_clone()
     test_elements()
     iterate_forward() # 10 tests
     iterate_backward() # 8 tests
+    iterate_wrong() # 1 test
 
 .end
 
@@ -131,6 +132,27 @@
     ok($I0, "Shifting from finished iterator throws exception")
 .end
 
+.sub 'iterate_wrong'
+    .local pmc s, it, ex
+    .local int r
+
+    s = new ['String']
+    s = 'BAZ'
+
+    it = iter s
+    push_eh catch_wrong
+    it = 42 # Let's hope we'll never have such direction
+    r = 0
+    goto dotest
+catch_wrong:
+    .get_results(ex)
+    finalize ex
+    pop_eh
+    r = 1
+dotest:
+    ok(r, "Caught wrong direction")
+.end
+
 # Local Variables:
 #   mode: pir
 #   fill-column: 100


More information about the parrot-commits mailing list