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

NotFound at svn.parrot.org NotFound at svn.parrot.org
Tue Jun 1 14:35:52 UTC 2010


Author: NotFound
Date: Tue Jun  1 14:35:51 2010
New Revision: 47255
URL: https://trac.parrot.org/parrot/changeset/47255

Log:
tests for LexPad elements and keyed access

Modified:
   trunk/t/pmc/lexpad.t

Modified: trunk/t/pmc/lexpad.t
==============================================================================
--- trunk/t/pmc/lexpad.t	Tue Jun  1 14:24:51 2010	(r47254)
+++ trunk/t/pmc/lexpad.t	Tue Jun  1 14:35:51 2010	(r47255)
@@ -19,9 +19,10 @@
 
 .sub main :main
     .include 'test_more.pir'
-    plan(4)
+    plan(8)
 
     new_test()
+    test_keyed()
     test_iter()
 .end
 
@@ -36,7 +37,31 @@
 end:
 .end
 
+.sub test_keyed
+    .local pmc p1
+    .lex 'p1', p1
+
+    $P0 = getinterp
+    $P0 = $P0['lexpad']
+    $I0 = elements $P0
+    is($I0, 1, "get LexPad elements")
 
+    $I0 = exists $P0['p1']
+    is($I0, 1, ".lex exists_keyed true")
+
+    $I0 = exists $P0['nosuchlex']
+    is($I0, 0, ".lex exists_keyed false")
+
+    $P1 = new 'Integer'
+    push_eh eh
+    $P0['nosuchlex'] = $P1
+    ok(0, "setting a non existent .lex should throw")
+    goto end
+eh:
+    pop_eh
+    ok(1, "setting a non existent .lex throws")
+end:
+.end
 
 .sub 'test_iter'
 


More information about the parrot-commits mailing list