2 # Copyright (C) 2005-2007, Parrot Foundation.
7 use lib qw( . lib ../lib ../../lib );
9 use Parrot::Test tests => 7;
14 t/dynpmc/dynlexpad.t - test the DynLexPad PMC
18 % prove t/dynpmc/dynlexpad.t
22 Tests the C<DynLexPad> PMC.
26 pir_output_is( << 'CODE', << 'OUTPUT', "loadlib" );
29 lib = loadlib "dynlexpad"
30 unless lib goto not_loaded
40 my $loadlib = <<'EOC';
45 .local pmc interp, lexpad, dynlexpad
47 lexpad = get_class 'LexPad'
48 dynlexpad = get_class 'DynLexPad'
49 interp.'hll_map'(lexpad, dynlexpad)
54 pir_output_is( $loadlib . << 'CODE', << 'OUTPUT', "store_lex" );
76 pir_output_is( $loadlib . << 'CODE', << 'OUTPUT', "check :outer" );
87 .const 'Sub' bar_sub = "bar"
88 $P0 = newclosure bar_sub
92 .const 'Sub' baz_sub = "baz"
93 $P0 = newclosure baz_sub
96 .sub baz :lex :outer(bar)
106 pir_output_is( $loadlib . << 'CODE', << 'OUTPUT', "tcl-ish upvar" );
117 .const 'Sub' bar_sub = "bar"
118 $P0 = newclosure bar_sub
126 .const 'Sub' baz_sub = "baz"
127 $P0 = newclosure baz_sub
130 .sub baz :lex :outer(bar)
135 .local pmc pad, interp
137 pad = interp["lexpad"; 2]
143 print "outer not found\n"
151 pir_output_is( $loadlib . << 'CODE', << 'OUTPUT', "check that dynlexpad honors hll" );
157 .local pmc pad, interp
159 pad = interp["lexpad"]
166 .local pmc pad, interp
168 pad = interp["lexpad"]
178 pir_output_is( $loadlib . << 'CODE', << 'OUTPUT', "dynlexpad - lexpad interop" );
184 .lex 'a', $P0 # static lexical
197 store_lex 'b', $P3 # and a dynamic one
208 local $TODO = "iterator not implemented for DynLexPads; TT #1028";
210 pir_output_is( $loadlib . << 'CODE', << 'OUTPUT', "dynlexpad - iterator" );
213 .sub 'onload' :immediate
218 core = get_class 'LexPad'
220 hll = get_class 'DynLexPad'
221 interp.'hll_map'(core,hll)
226 .local pmc str1,str2,str3
239 dlp = interp['lexpad']
244 unless iterator goto iter_done
262 # cperl-indent-level: 4
265 # vim: expandtab shiftwidth=4: