[svn:parrot] r38894 - branches/tt504_annotations/t/pmc

bacek at svn.parrot.org bacek at svn.parrot.org
Mon May 18 12:30:51 UTC 2009


Author: bacek
Date: Mon May 18 12:30:50 2009
New Revision: 38894
URL: https://trac.parrot.org/parrot/changeset/38894

Log:
[t] Add test for PackfileConstantTable.get_or_create_constant

Modified:
   branches/tt504_annotations/t/pmc/packfileconstanttable.t

Modified: branches/tt504_annotations/t/pmc/packfileconstanttable.t
==============================================================================
--- branches/tt504_annotations/t/pmc/packfileconstanttable.t	Mon May 18 11:22:26 2009	(r38893)
+++ branches/tt504_annotations/t/pmc/packfileconstanttable.t	Mon May 18 12:30:50 2009	(r38894)
@@ -27,12 +27,13 @@
 .sub 'main' :main
 .include 'test_more.pir'
 .include 'packfile_constants.pasm'
-    'plan'(10)
+    'plan'(12)
 
     'test_sanity'()
     'test_elements'()
     'test_get'()
     'test_set'()
+    'test_get_or_create'()
 .end
 
 
@@ -140,6 +141,17 @@
 
 .end
 
+.sub 'test_get_or_create'
+    .local pmc pfc
+    pfc = new 'PackfileConstantTable'
+    $I1 = pfc.'get_or_create_constant'('foo')
+    $I2 = pfc.'get_or_create_constant'('foo')
+    is($I1, $I2, "get_or_create_constant returs same value for same key")
+    
+    $I2 = pfc.'get_or_create_constant'('bar')
+    $I0 = $I1 != $I2
+    ok($I0, "get_or_create_constant returs different values for different keys")
+.end
 
 .sub '_get_consttable'
     .param pmc pf


More information about the parrot-commits mailing list