2 # Copyright (C) 2007-2009, Parrot Foundation.
7 t/compilers/pge/04-compile.t - Test our ability to compile regexes into various names
11 % prove t/compilers/pge/04-compile.t
15 Tests various arguments to the compiler.
22 .include 'test_more.pir'
25 test_basic_compile_no_name_grammar()
26 test_compile_into_current_namespace()
27 test_compile_into_a_new_grammar()
28 test_compile_into_a_new_grammar_2x()
32 .sub test_basic_compile_no_name_grammar
33 load_bytecode 'PGE.pbc'
36 p6compiler = compreg 'PGE::Perl6Regex'
37 $P1 = p6compiler('.+')
39 is($P2, 'ok 1', 'basic compile, no name/grammar')
43 .sub test_compile_into_current_namespace
44 load_bytecode 'PGE.pbc'
47 p6compiler = compreg 'PGE::Perl6Regex'
48 $P1 = p6compiler('.+', 'name'=>'xyz', 'grammar'=>'')
50 is($P2, 'ok 1', 'compile into current namespace')
54 .sub test_compile_into_a_new_grammar
55 load_bytecode 'PGE.pbc'
58 p6compiler = compreg 'PGE::Perl6Regex'
59 $P1 = p6compiler('.+', 'name'=>'xyz1', 'grammar'=>'PGE::Test')
60 $P2 = get_hll_global ['PGE';'Test'], 'xyz1'
62 is($P3, 'ok 1', 'compile into a new grammar')
66 .sub test_compile_into_a_new_grammar_2x
67 load_bytecode 'PGE.pbc'
70 p6compiler = compreg 'PGE::Perl6Regex'
71 $P1 = p6compiler('.+', 'name'=>'abc', 'grammar'=>'PGE::Test')
72 $P1 = p6compiler('.+', 'name'=>'xyz2', 'grammar'=>'PGE::Test')
73 $P2 = get_hll_global ['PGE';'Test'], 'abc'
75 is($P3, 'ok 1', 'compile into a new grammar, 2x')
82 # vim: expandtab shiftwidth=4 ft=pir: