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

NotFound at svn.parrot.org NotFound at svn.parrot.org
Wed Oct 27 21:02:29 UTC 2010


Author: NotFound
Date: Wed Oct 27 21:02:29 2010
New Revision: 49698
URL: https://trac.parrot.org/parrot/changeset/49698

Log:
tests for String exists_keyed vtable

Modified:
   trunk/t/pmc/string.t

Modified: trunk/t/pmc/string.t
==============================================================================
--- trunk/t/pmc/string.t	Wed Oct 27 20:48:46 2010	(r49697)
+++ trunk/t/pmc/string.t	Wed Oct 27 21:02:29 2010	(r49698)
@@ -19,7 +19,7 @@
 .sub main :main
     .include 'test_more.pir'
 
-    plan(124)
+    plan(129)
 
     set_or_get_strings()
     setting_integers()
@@ -58,6 +58,7 @@
     exception_to_int_3()
     assign_null_string()
     access_keyed()
+    exists_keyed()
     # END_OF_TESTS
 .end
 
@@ -776,6 +777,29 @@
   done_null_replace:
 .end
 
+.sub exists_keyed
+    .local pmc s, i
+    .local int r
+    s = new['String']
+    s = ''
+    i = new['Integer']
+    i = 0
+    r = exists s[i]
+    is(r, 0, 'exists_keyed on empty String')
+    s = 'a'
+    r = exists s[i]
+    is(r, 1, 'exists_keyed within bounds')
+    i = 1
+    r = exists s[i]
+    is(r, 0, 'exists_keyed out of bounds')
+    i = -1
+    r = exists s[i]
+    is(r, 1, 'exists_keyed negative within bounds')
+    i = -2
+    r = exists s[i]
+    is(r, 0, 'exists_keyed negative out of bounds')
+.end
+
 # Local Variables:
 #   mode: pir
 #   fill-column: 100


More information about the parrot-commits mailing list