2 # Copyright (C) 2001-2009, Parrot Foundation.
20 .include 'test_more.pir'
25 extract_int_from_string_keys()
26 extract_string_from_int_keys()
28 do_not_collect_string_keys_early_rt_60128()
31 .sub traverse_key_chain
53 is( result, '123', 'traverse key chain' )
65 is( result, '123', 'traverse second key chain' )
68 .sub extract_int_from_string_keys
69 new $P0, ['ResizableStringArray']
74 is( $P1, 'ok1', 'retrieve key is number as string' )
76 is( $P1, 'ok2', 'retrieved key is number as str const' )
79 .sub extract_string_from_int_keys
85 is( $P1, 'ok1', 'retrieve key is int, set key was str const' )
87 is( $P1, 'ok2', 'retrieve key is const int, set key was str const' )
98 is(key, "1.234", "number-valued Key stringification works")
102 is(foo, "FOO", "set/get via number-valued Key works")
106 .sub do_not_collect_string_keys_early_rt_60128
108 proc = get_root_global [ 'tcl' ], '&proc'
110 a = get_root_global [ 'tcl' ], '&a'
114 ok(1, 'register and non-register string keys should be COW' )
117 # support for do_not_collect_string_keys_early_rt_60128
123 .local pmc call_chain, lexpad
124 call_chain = get_root_global ['_tcl'], 'call_chain'
125 lexpad = call_chain[-1]
128 iterator = iter lexpad
130 unless iterator goto end
131 elem = shift iterator
132 $S0 = replace elem, 0, 1, ''
143 .local pmc call_chain, lexpad
144 call_chain = get_root_global ['_tcl'], 'call_chain'
145 lexpad = new ['Hash']
146 push call_chain, lexpad
148 arg_list = new ['ResizablePMCArray']
149 lexpad['args'] = arg_list
150 $P14 = find_name "&info"
157 .local pmc pir_compiler
158 pir_compiler = compreg 'PIR'
159 $P0 = pir_compiler($S0)
161 $P1 = new ['TclProc']
164 ns_target = get_hll_namespace
165 ns_target['&a'] = $P1
171 .sub prepare_lib :init
172 $P0 = get_class 'Sub'
173 $P1 = subclass $P0, 'TclProc'
174 $P1 = new ['ResizablePMCArray']
175 set_global 'call_chain', $P1
182 # vim: expandtab shiftwidth=4 ft=pir: