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

NotFound at svn.parrot.org NotFound at svn.parrot.org
Mon Jun 14 15:09:54 UTC 2010


Author: NotFound
Date: Mon Jun 14 15:09:53 2010
New Revision: 47621
URL: https://trac.parrot.org/parrot/changeset/47621

Log:
more StringIterator tests, covering mark, clone and get_integer

Modified:
   trunk/t/pmc/stringiterator.t

Modified: trunk/t/pmc/stringiterator.t
==============================================================================
--- trunk/t/pmc/stringiterator.t	Mon Jun 14 14:37:46 2010	(r47620)
+++ trunk/t/pmc/stringiterator.t	Mon Jun 14 15:09:53 2010	(r47621)
@@ -21,13 +21,48 @@
 .sub main :main
     .include 'test_more.pir'
 
-    plan(18)
+    plan(21)
 
+    test_clone()
+    test_elements()
     iterate_forward() # 10 tests
     iterate_backward() # 8 tests
 
 .end
 
+.sub 'test_clone'
+    .local pmc s, it, itc
+    .local int nit, nitc
+
+    s = new ['String']
+    s = 'somestring'
+    it = iter s
+    # Get a clone and make sure both the original and the clone
+    # gets marked.
+    sweep 1
+    nit = elements it
+    itc = clone it
+    sweep 1
+    nitc = elements itc
+    is(nit, nitc, "clone has same length as original")
+.end
+
+.sub test_elements
+    .local string s
+    .local pmc ps, it
+    .local int ns, nit
+
+    s = 'someotherstring'
+    ps = new ['String']
+    ps = s
+    it = iter ps
+    ns = length s
+    nit = elements it
+    is(ns, nit, "iter elements is equal to string length")
+    nit = it
+    is(ns, nit, "iter get_integer is equal to string length")
+.end
+
 .sub 'iterate_forward'
     .local pmc s, it
 


More information about the parrot-commits mailing list