Ticket #1335: compilers_pge_04_compile.patch

File compilers_pge_04_compile.patch, 2.9 KB (added by bubaflub, 12 years ago)

patch to convert t/compilers/pge/04-compile.t to PIR

  • t/compilers/pge/04-compile.t

    diff --git t/compilers/pge/04-compile.t t/compilers/pge/04-compile.t
    index 1c9475b..404d1e6 100644
     
    1 #! perl 
     1#!parrot 
    22# $Id$ 
    33 
    4 # Copyright (C) 2007, Parrot Foundation. 
    5  
    6 use strict; 
    7 use warnings; 
    8 use lib qw( t . lib ../lib ../../lib ../../../lib ); 
    9 use Test::More; 
    10 use Parrot::Test tests => 4; 
     4# Copyright (C) 2007-2009, Parrot Foundation. 
    115 
    126=head1 NAME 
    137 
     
    2216Tests various arguments to the compiler. 
    2317 
    2418=cut 
    25  
    26 pir_output_is( <<'CODE', <<'OUTPUT', 'basic compile, no name/grammar' ); 
    2719.namespace [] 
    2820 
    2921.sub main :main 
     22    .include 'test_more.pir' 
     23    plan(4) 
     24 
     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 
     30 
     31.sub test_basic_compile_no_name_grammar 
    3032    load_bytecode 'PGE.pbc' 
    3133 
    3234    .local pmc p6compiler 
    3335    p6compiler = compreg 'PGE::Perl6Regex' 
    3436    $P1 = p6compiler('.+') 
    3537    $P2 = $P1('ok 1') 
    36     say $P2 
     38    is($P2, 'ok 1', 'basic compile, no name/grammar') 
    3739.end 
    38 CODE 
    39 ok 1 
    40 OUTPUT 
    4140 
    42 pir_output_is( <<'CODE', <<'OUTPUT', 'compile into current namespace' ); 
    43 .namespace [] 
    44  
    45 .sub main :main 
     41.sub test_compile_into_current_namespace 
    4642    load_bytecode 'PGE.pbc' 
    4743 
    4844    .local pmc p6compiler 
    4945    p6compiler = compreg 'PGE::Perl6Regex' 
    5046    $P1 = p6compiler('.+', 'name'=>'xyz', 'grammar'=>'') 
    5147    $P2 = 'xyz'('ok 1') 
    52     say $P2 
     48    is($P2, 'ok 1', 'compile into current namespace') 
    5349.end 
    54 CODE 
    55 ok 1 
    56 OUTPUT 
    5750 
    58 pir_output_is( <<'CODE', <<'OUTPUT', 'compile into a new grammar' ); 
    59 .sub main :main 
     51.sub test_compile_into_a_new_grammar 
    6052    load_bytecode 'PGE.pbc' 
    6153 
    6254    .local pmc p6compiler 
    6355    p6compiler = compreg 'PGE::Perl6Regex' 
    64     $P1 = p6compiler('.+', 'name'=>'xyz', 'grammar'=>'PGE::Test') 
    65     $P2 = get_hll_global ['PGE';'Test'], 'xyz' 
     56    $P1 = p6compiler('.+', 'name'=>'xyz1', 'grammar'=>'PGE::Test') 
     57    $P2 = get_hll_global ['PGE';'Test'], 'xyz1' 
    6658    $P3 = $P2('ok 1') 
    67     say $P3 
     59    is($P3, 'ok 1', 'compile into a new grammar') 
    6860.end 
    69 CODE 
    70 ok 1 
    71 OUTPUT 
    7261 
    73 pir_output_is( <<'CODE', <<'OUTPUT', 'compile into a new grammar, 2x' ); 
    74 .sub main :main 
     62.sub test_compile_into_a_new_grammar_2x 
    7563    load_bytecode 'PGE.pbc' 
    7664 
    7765    .local pmc p6compiler 
    7866    p6compiler = compreg 'PGE::Perl6Regex' 
    7967    $P1 = p6compiler('.+', 'name'=>'abc', 'grammar'=>'PGE::Test') 
    80     $P1 = p6compiler('.+', 'name'=>'xyz', 'grammar'=>'PGE::Test') 
     68    $P1 = p6compiler('.+', 'name'=>'xyz2', 'grammar'=>'PGE::Test') 
    8169    $P2 = get_hll_global ['PGE';'Test'], 'abc' 
    8270    $P3 = $P2('ok 1') 
    83     say $P3 
     71    is($P3, 'ok 1', 'compile into a new grammar, 2x') 
    8472.end 
    85 CODE 
    86 ok 1 
    87 OUTPUT 
    8873 
    8974# Local Variables: 
    9075#   mode: cperl 
    9176#   cperl-indent-level: 4 
    9277#   fill-column: 100 
    9378# End: 
    94 # vim: expandtab shiftwidth=4: 
    95  
     79# vim: expandtab shiftwidth=4 filetype=pir: