2 # Copyright (C) 2001-2007, Parrot Foundation.
7 use lib qw( t . lib ../lib ../../lib );
9 use Parrot::Test tests => 8;
10 use Parrot::Test::PGE;
18 % prove -Ilib t/library/pge_util.t
22 Parrot Grammar Engine tests of utility rules
26 my $str = "How will this\nstring choose\nto explode?\n\nTest";
29 "expl <PGE::Util::die: 'kaboom'>",
30 qr/^kaboom at line 3, near "ode\?\\n\\n/, "die"
33 pir_output_is( <<'CODE', <<'OUT', "split /\\:+/, 'Foo::Bar::baz'" );
36 load_bytecode 'PGE.pbc'
37 load_bytecode 'PGE/Util.pbc'
39 .local pmc split, p6rule, regex
40 split = get_global ['PGE';'Util'], 'split'
41 p6rule = compreg 'PGE::Perl6Regex'
44 $P0 = split(regex, "Foo::Bar::baz")
56 pir_output_is( <<'CODE', <<'OUT', "split /\\:+/, 'Foo::'" );
59 load_bytecode 'PGE.pbc'
60 load_bytecode 'PGE/Util.pbc'
62 .local pmc split, p6rule, regex
63 split = get_global ['PGE';'Util'], 'split'
64 p6rule = compreg 'PGE::Perl6Regex'
67 $P0 = split(regex, "Foo::")
77 pir_output_is( <<'CODE', <<'OUT', "split /\\:+/, '::Foo'" );
80 load_bytecode 'PGE.pbc'
81 load_bytecode 'PGE/Util.pbc'
83 .local pmc split, p6rule, regex
84 split = get_global ['PGE';'Util'], 'split'
85 p6rule = compreg 'PGE::Perl6Regex'
88 $P0 = split(regex, "::Foo")
99 pir_output_is( <<'CODE', <<'OUT', "split /\\:+/, 'Foo'" );
102 load_bytecode 'PGE.pbc'
103 load_bytecode 'PGE/Util.pbc'
105 .local pmc split, p6rule, regex
106 split = get_global ['PGE';'Util'], 'split'
107 p6rule = compreg 'PGE::Perl6Regex'
108 regex = p6rule('\:+')
110 $P0 = split(regex, "Foo")
120 pir_output_is( <<'CODE', <<'OUT', "split /\\:/, 'Foo::Bar'" );
123 load_bytecode 'PGE.pbc'
124 load_bytecode 'PGE/Util.pbc'
126 .local pmc split, p6rule, regex
127 split = get_global ['PGE';'Util'], 'split'
128 p6rule = compreg 'PGE::Perl6Regex'
131 $P0 = split(regex, "Foo::Bar")
143 pir_output_is( <<'CODE', <<'OUT', "split /\\:/, 'Foo::Bar::Baz', 2" );
146 load_bytecode 'PGE.pbc'
147 load_bytecode 'PGE/Util.pbc'
149 .local pmc split, p6rule, regex
150 split = get_global ['PGE';'Util'], 'split'
151 p6rule = compreg 'PGE::Perl6Regex'
152 regex = p6rule('\:+')
154 $P0 = split(regex, "Foo::Bar::Baz", 2)
165 pir_output_is( <<'CODE', <<'OUT', "split /(a)(b)/, 'abracadabra'" );
168 load_bytecode 'PGE.pbc'
169 load_bytecode 'PGE/Util.pbc'
171 .local pmc split, p6rule, regex
172 split = get_global ['PGE';'Util'], 'split'
173 p6rule = compreg 'PGE::Perl6Regex'
174 regex = p6rule('(a)(b)')
176 $P0 = split(regex, "abracadabra")
188 # cperl-indent-level: 4
191 # vim: expandtab shiftwidth=4: