fix codetest failure - ASSERT_ARGS does not have a ; after and
[parrot.git] / t / compilers / pge / 04-compile.t
blobf695dae0c770cc454a9bd66f26c51ea0cb5e1617
1 #!./parrot
2 # Copyright (C) 2007-2009, Parrot Foundation.
3 # $Id$
5 =head1 NAME
7 t/compilers/pge/04-compile.t - Test our ability to compile regexes into various names
9 =head1 SYNOPSIS
11         % prove t/compilers/pge/04-compile.t
13 =head1 DESCRIPTION
15 Tests various arguments to the compiler.
17 =cut
19 .namespace []
21 .sub main :main
22     .include 'test_more.pir'
23     plan(4)
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()
29 .end
32 .sub test_basic_compile_no_name_grammar
33     load_bytecode 'PGE.pbc'
35     .local pmc p6compiler
36     p6compiler = compreg 'PGE::Perl6Regex'
37     $P1 = p6compiler('.+')
38     $P2 = $P1('ok 1')
39     is($P2, 'ok 1', 'basic compile, no name/grammar')
40 .end
43 .sub test_compile_into_current_namespace
44     load_bytecode 'PGE.pbc'
46     .local pmc p6compiler
47     p6compiler = compreg 'PGE::Perl6Regex'
48     $P1 = p6compiler('.+', 'name'=>'xyz', 'grammar'=>'')
49     $P2 = 'xyz'('ok 1')
50     is($P2, 'ok 1', 'compile into current namespace')
51 .end
54 .sub test_compile_into_a_new_grammar
55     load_bytecode 'PGE.pbc'
57     .local pmc p6compiler
58     p6compiler = compreg 'PGE::Perl6Regex'
59     $P1 = p6compiler('.+', 'name'=>'xyz1', 'grammar'=>'PGE::Test')
60     $P2 = get_hll_global ['PGE';'Test'], 'xyz1'
61     $P3 = $P2('ok 1')
62     is($P3, 'ok 1', 'compile into a new grammar')
63 .end
66 .sub test_compile_into_a_new_grammar_2x
67     load_bytecode 'PGE.pbc'
69     .local pmc p6compiler
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'
74     $P3 = $P2('ok 1')
75     is($P3, 'ok 1', 'compile into a new grammar, 2x')
76 .end
78 # Local Variables:
79 #   mode: pir
80 #   fill-column: 100
81 # End:
82 # vim: expandtab shiftwidth=4 ft=pir: