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

NotFound at svn.parrot.org NotFound at svn.parrot.org
Thu Sep 9 20:10:44 UTC 2010


Author: NotFound
Date: Thu Sep  9 20:10:43 2010
New Revision: 48888
URL: https://trac.parrot.org/parrot/changeset/48888

Log:
rearrange HashIteratorKey tests and add a few more

Modified:
   trunk/t/pmc/hashiteratorkey.t

Modified: trunk/t/pmc/hashiteratorkey.t
==============================================================================
--- trunk/t/pmc/hashiteratorkey.t	Thu Sep  9 19:09:26 2010	(r48887)
+++ trunk/t/pmc/hashiteratorkey.t	Thu Sep  9 20:10:43 2010	(r48888)
@@ -20,11 +20,22 @@
 .sub 'main'
     .include 'test_more.pir'
 
-    plan(3)
+    plan(6)
 
+    'test_new'()
+    'test_key_value'()
+    'test_empty'()
+
+.end
+
+
+.sub 'test_new'
     $P0 = new ['HashIteratorKey']
     ok(1, "Can create HashIteratorKey directly")
+.end
+
 
+.sub 'test_key_value'
     $P0 = new ['Hash']
     $P0['foo'] = 'bar'
     $P1 = iter $P0
@@ -36,6 +47,27 @@
 .end
 
 
+.sub 'test_empty'
+    .local pmc hik, p
+    .local int i
+    .local string s
+    hik = new ['HashIteratorKey']
+
+    # De facto behavior tested for code coverage
+
+    p = hik.'key'() 
+    i = isnull p
+    is(i, 1, 'HIK.key gives null when unitialized')
+
+    s = hik
+    is(s, '', 'HIK gives empty string when unitialized')
+
+    # Magic value?
+    i = hik
+    is(i, -1, 'HIK get_integer gives -1')
+.end
+
+
 # Local Variables:
 #   mode: pir
 #   fill-column: 100


More information about the parrot-commits mailing list