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

NotFound at svn.parrot.org NotFound at svn.parrot.org
Fri Aug 27 12:20:45 UTC 2010


Author: NotFound
Date: Fri Aug 27 12:20:44 2010
New Revision: 48693
URL: https://trac.parrot.org/parrot/changeset/48693

Log:
test get and set value type in Hash PMC

Modified:
   trunk/t/pmc/hash.t

Modified: trunk/t/pmc/hash.t
==============================================================================
--- trunk/t/pmc/hash.t	Fri Aug 27 08:46:45 2010	(r48692)
+++ trunk/t/pmc/hash.t	Fri Aug 27 12:20:44 2010	(r48693)
@@ -25,11 +25,12 @@
 .sub main :main
     .include 'test_more.pir'
 
-    plan(172)
+    plan(174)
 
     initial_hash_tests()
     more_than_one_hash()
     hash_key_type()
+    hash_value_type()
     null_key()
     hash_keys_with_nulls_in_them()
     nearly_the_same_hash_keys()
@@ -156,6 +157,26 @@
 end:
 .end
 
+.sub hash_value_type
+    .local pmc h, eh
+    .local int r
+    h = new ['Hash']
+
+    h.'set_value_type'(.DATATYPE_INTVAL)
+    r  = h.'get_value_type'()
+    is(r, .DATATYPE_INTVAL, 'get/set _value_type')
+
+    r = 1
+    eh = new ['ExceptionHandler']
+    eh.'handle_types'(.EXCEPTION_UNIMPLEMENTED)
+    set_label eh, catch
+    push_eh eh
+    h.'set_value_type'(999999)
+    r = 0
+  catch:
+    is(r, 1, 'set_value_type with invalid type throws')
+.end
+
 .sub null_key
     new $P0, ['Hash']
     $P0['yum'] = 5


More information about the parrot-commits mailing list