tagged release 0.7.1
[parrot.git] / t / compilers / pge / 02-match.t
blob59db7dff380866836303000ef81f7fbf9929f757
1 #!perl
2 # Copyright (C) 2006-2007, The Perl Foundation.
3 # $Id$
5 use strict;
6 use warnings;
7 use lib qw( . lib ../lib ../../lib );
8 use Test::More;
9 use Parrot::Test tests => 2;
11 =head1 NAME
13 t/compilers/pge/02-match.t - test the Match class
16 =head1 SYNOPSIS
18         % prove t/compilers/pge/02-match.t
20 =head1 DESCRIPTION
22 Tests the Match class directly.
24 =cut
26 pir_output_is( <<'CODE', <<'OUTPUT', 'concat on a Match object (rt#39135)' );
27 .sub main :main
28     load_bytecode 'PGE.pbc'
30     $P0 = compreg 'PGE::Perl6Regex'
31     $P1 = $P0('.+')
32     $P2 = $P1('world')
34     say $P2              # world
36     $P3 = new 'String'
37     $P3 = 'hello '
39     $P4 = n_concat $P3, $P2
40     say $P4              # hello world
41 .end
43 CODE
44 world
45 hello world
46 OUTPUT
48 pir_output_is( <<'CODE', <<'OUTPUT', 'push on a Match object' );
49 .sub main :main
50     .local pmc match, str, arr
51     load_bytecode 'PGE.pbc'
52     match = new 'PGE::Match'
53     str = new 'String'
54     str = 'foo'
55     push match, str
56     arr = match.'list'()
57     $I0 = elements arr
58     print $I0
59     print "\n"
60     $P3 = match[0]
61     say $P3
62 .end
63 CODE
65 foo
66 OUTPUT
68 # Local Variables:
69 #   mode: cperl
70 #   cperl-indent-level: 4
71 #   fill-column: 100
72 # End:
73 # vim: expandtab shiftwidth=4: