diff --git t/compilers/pge/04-compile.t t/compilers/pge/04-compile.t index 1c9475b..404d1e6 100644 --- t/compilers/pge/04-compile.t +++ t/compilers/pge/04-compile.t @@ -1,13 +1,7 @@ -#! perl +#!parrot # $Id$ -# Copyright (C) 2007, Parrot Foundation. - -use strict; -use warnings; -use lib qw( t . lib ../lib ../../lib ../../../lib ); -use Test::More; -use Parrot::Test tests => 4; +# Copyright (C) 2007-2009, Parrot Foundation. =head1 NAME @@ -22,74 +16,64 @@ t/compilers/pge/04-compile.t - Test our ability to compile regexes into various Tests various arguments to the compiler. =cut - -pir_output_is( <<'CODE', <<'OUTPUT', 'basic compile, no name/grammar' ); .namespace [] .sub main :main + .include 'test_more.pir' + plan(4) + + test_basic_compile_no_name_grammar() + test_compile_into_current_namespace() + test_compile_into_a_new_grammar() + test_compile_into_a_new_grammar_2x() +.end + +.sub test_basic_compile_no_name_grammar load_bytecode 'PGE.pbc' .local pmc p6compiler p6compiler = compreg 'PGE::Perl6Regex' $P1 = p6compiler('.+') $P2 = $P1('ok 1') - say $P2 + is($P2, 'ok 1', 'basic compile, no name/grammar') .end -CODE -ok 1 -OUTPUT -pir_output_is( <<'CODE', <<'OUTPUT', 'compile into current namespace' ); -.namespace [] - -.sub main :main +.sub test_compile_into_current_namespace load_bytecode 'PGE.pbc' .local pmc p6compiler p6compiler = compreg 'PGE::Perl6Regex' $P1 = p6compiler('.+', 'name'=>'xyz', 'grammar'=>'') $P2 = 'xyz'('ok 1') - say $P2 + is($P2, 'ok 1', 'compile into current namespace') .end -CODE -ok 1 -OUTPUT -pir_output_is( <<'CODE', <<'OUTPUT', 'compile into a new grammar' ); -.sub main :main +.sub test_compile_into_a_new_grammar load_bytecode 'PGE.pbc' .local pmc p6compiler p6compiler = compreg 'PGE::Perl6Regex' - $P1 = p6compiler('.+', 'name'=>'xyz', 'grammar'=>'PGE::Test') - $P2 = get_hll_global ['PGE';'Test'], 'xyz' + $P1 = p6compiler('.+', 'name'=>'xyz1', 'grammar'=>'PGE::Test') + $P2 = get_hll_global ['PGE';'Test'], 'xyz1' $P3 = $P2('ok 1') - say $P3 + is($P3, 'ok 1', 'compile into a new grammar') .end -CODE -ok 1 -OUTPUT -pir_output_is( <<'CODE', <<'OUTPUT', 'compile into a new grammar, 2x' ); -.sub main :main +.sub test_compile_into_a_new_grammar_2x load_bytecode 'PGE.pbc' .local pmc p6compiler p6compiler = compreg 'PGE::Perl6Regex' $P1 = p6compiler('.+', 'name'=>'abc', 'grammar'=>'PGE::Test') - $P1 = p6compiler('.+', 'name'=>'xyz', 'grammar'=>'PGE::Test') + $P1 = p6compiler('.+', 'name'=>'xyz2', 'grammar'=>'PGE::Test') $P2 = get_hll_global ['PGE';'Test'], 'abc' $P3 = $P2('ok 1') - say $P3 + is($P3, 'ok 1', 'compile into a new grammar, 2x') .end -CODE -ok 1 -OUTPUT # Local Variables: # mode: cperl # cperl-indent-level: 4 # fill-column: 100 # End: -# vim: expandtab shiftwidth=4: - +# vim: expandtab shiftwidth=4 filetype=pir: