2 # Copyright (C) 2006-2010, Parrot Foundation.
7 t/pmc/lexinfo.t - test LexInfo PMC
12 % prove t/pmc/lexinfo.t
16 Tests the LexInfo PMC.
20 .include 'except_types.pasm'
23 .include 'test_more.pir'
27 inspect_invalid_test()
28 declare_lex_preg_test()
35 $P2 = new 'ParrotInterpreter'
37 $P2 = $P2.'get_lexinfo'()
38 $P2 = inspect $P2, 'symbols'
40 is($I0, 2, "correct number of symbol in introspection hash")
42 .local int have_a, have_b
46 if $S0 != "$a" goto not_a_1
49 if $S0 != "$b" goto not_b_1
54 if $S0 != "$a" goto not_a_2
57 if $S0 != "$b" goto not_b_2
61 is(have_a, 1, "$a symbol was in list")
62 is(have_b, 1, "$b symbol was in list")
65 .sub inspect_invalid_test
71 in = inspect li, 'fubar'
76 r = iseq type, .EXCEPTION_INVALID_OPERATION
78 ok(r, 'invalid introspection key throws as expected')
81 .sub declare_lex_preg_test
82 .const string preg_name = 'foo'
83 .const int preg_value = 42
86 li.'declare_lex_preg'(preg_name, preg_value)
89 is(r, preg_value, 'declare_lex_preg method')
96 # vim: expandtab shiftwidth=4 ft=pir: