diff --git t/compilers/pge/02-match.t t/compilers/pge/02-match.t
index 03cd448..ed05968 100644
|
|
|
|
| 1 | | #!perl |
| 2 | | # Copyright (C) 2006-2007, Parrot Foundation. |
| | 1 | #!parrot |
| | 2 | # Copyright (C) 2006-2009, Parrot Foundation. |
| 3 | 3 | # $Id$ |
| 4 | 4 | |
| 5 | | use strict; |
| 6 | | use warnings; |
| 7 | | use lib qw( . lib ../lib ../../lib ); |
| 8 | | use Test::More; |
| 9 | | use Parrot::Test tests => 2; |
| 10 | | |
| 11 | 5 | =head1 NAME |
| 12 | 6 | |
| 13 | 7 | t/compilers/pge/02-match.t - test the Match class |
| … |
… |
|
| 23 | 17 | |
| 24 | 18 | =cut |
| 25 | 19 | |
| 26 | | pir_output_is( <<'CODE', <<'OUTPUT', 'concat on a Match object (rt#39135)' ); |
| 27 | 20 | .sub main :main |
| | 21 | .include 'test_more.pir' |
| | 22 | plan(4) |
| | 23 | |
| | 24 | test_concat_on_a_match_object() |
| | 25 | test_push_on_a_match_object() |
| | 26 | .end |
| | 27 | |
| | 28 | .sub test_concat_on_a_match_object |
| 28 | 29 | load_bytecode 'PGE.pbc' |
| 29 | 30 | |
| 30 | 31 | $P0 = compreg 'PGE::Perl6Regex' |
| 31 | 32 | $P1 = $P0('.+') |
| 32 | 33 | $P2 = $P1('world') |
| 33 | 34 | |
| 34 | | say $P2 # world |
| | 35 | is($P2, 'world', 'concat on a Match object (rt#39135)') |
| 35 | 36 | |
| 36 | 37 | $P3 = new 'String' |
| 37 | 38 | $P3 = 'hello ' |
| 38 | 39 | |
| 39 | 40 | $P4 = concat $P3, $P2 |
| 40 | | say $P4 # hello world |
| | 41 | is($P4, 'hello world', 'concat on a Match object (rt#39135)') |
| 41 | 42 | .end |
| 42 | 43 | |
| 43 | | CODE |
| 44 | | world |
| 45 | | hello world |
| 46 | | OUTPUT |
| 47 | | |
| 48 | | pir_output_is( <<'CODE', <<'OUTPUT', 'push on a Match object' ); |
| 49 | | .sub main :main |
| | 44 | .sub test_push_on_a_match_object |
| 50 | 45 | .local pmc match, str, arr |
| 51 | 46 | load_bytecode 'PGE.pbc' |
| 52 | 47 | match = new ['PGE';'Match'] |
| … |
… |
|
| 55 | 50 | push match, str |
| 56 | 51 | arr = match.'list'() |
| 57 | 52 | $I0 = elements arr |
| 58 | | print $I0 |
| 59 | | print "\n" |
| | 53 | is($I0, 1, 'push on a Match object') |
| 60 | 54 | $P3 = match[0] |
| 61 | | say $P3 |
| | 55 | is($P3, 'foo', 'push on a Match object') |
| 62 | 56 | .end |
| 63 | | CODE |
| 64 | | 1 |
| 65 | | foo |
| 66 | | OUTPUT |
| 67 | 57 | |
| 68 | 58 | # Local Variables: |
| 69 | 59 | # mode: cperl |
| 70 | 60 | # cperl-indent-level: 4 |
| 71 | 61 | # fill-column: 100 |
| 72 | 62 | # End: |
| 73 | | # vim: expandtab shiftwidth=4: |
| | 63 | # vim: expandtab shiftwidth=4 filetype=pir: |