2 # Copyright (C) 2001-2007, The Perl Foundation.
7 use lib qw( t . lib ../lib ../../lib );
9 use Parrot::Test tests => 8;
10 use Parrot::Test::PGE;
14 t/library/pge_util.t - Parrot Grammar Engine tests of utility rules
18 % prove -Ilib t/library/pge_util.t
22 my $str = "How will this\nstring choose\nto explode?\n\nTest";
25 "expl <PGE::Util::die: 'kaboom'>",
26 qr/^kaboom at line 3, near "ode\?\\n\\n/, "die"
29 pir_output_is( <<'CODE', <<'OUT', "split /\\:+/, 'Foo::Bar::baz'" );
32 load_bytecode 'PGE.pbc'
33 load_bytecode 'PGE/Util.pir'
35 .local pmc split, p6rule, regex
36 split = get_global ['PGE::Util'], 'split'
37 p6rule = compreg 'PGE::Perl6Regex'
40 $P0 = split(regex, "Foo::Bar::baz")
52 pir_output_is( <<'CODE', <<'OUT', "split /\\:+/, 'Foo::'" );
55 load_bytecode 'PGE.pbc'
56 load_bytecode 'PGE/Util.pir'
58 .local pmc split, p6rule, regex
59 split = get_global ['PGE::Util'], 'split'
60 p6rule = compreg 'PGE::Perl6Regex'
63 $P0 = split(regex, "Foo::")
73 pir_output_is( <<'CODE', <<'OUT', "split /\\:+/, '::Foo'" );
76 load_bytecode 'PGE.pbc'
77 load_bytecode 'PGE/Util.pir'
79 .local pmc split, p6rule, regex
80 split = get_global ['PGE::Util'], 'split'
81 p6rule = compreg 'PGE::Perl6Regex'
84 $P0 = split(regex, "::Foo")
95 pir_output_is( <<'CODE', <<'OUT', "split /\\:+/, 'Foo'" );
98 load_bytecode 'PGE.pbc'
99 load_bytecode 'PGE/Util.pir'
101 .local pmc split, p6rule, regex
102 split = get_global ['PGE::Util'], 'split'
103 p6rule = compreg 'PGE::Perl6Regex'
104 regex = p6rule('\:+')
106 $P0 = split(regex, "Foo")
116 pir_output_is( <<'CODE', <<'OUT', "split /\\:/, 'Foo::Bar'" );
119 load_bytecode 'PGE.pbc'
120 load_bytecode 'PGE/Util.pir'
122 .local pmc split, p6rule, regex
123 split = get_global ['PGE::Util'], 'split'
124 p6rule = compreg 'PGE::Perl6Regex'
127 $P0 = split(regex, "Foo::Bar")
139 pir_output_is( <<'CODE', <<'OUT', "split /\\:/, 'Foo::Bar::Baz', 2" );
142 load_bytecode 'PGE.pbc'
143 load_bytecode 'PGE/Util.pir'
145 .local pmc split, p6rule, regex
146 split = get_global ['PGE::Util'], 'split'
147 p6rule = compreg 'PGE::Perl6Regex'
148 regex = p6rule('\:+')
150 $P0 = split(regex, "Foo::Bar::Baz", 2)
161 pir_output_is( <<'CODE', <<'OUT', "split /(a)(b)/, 'abracadabra'" );
164 load_bytecode 'PGE.pbc'
165 load_bytecode 'PGE/Util.pir'
167 .local pmc split, p6rule, regex
168 split = get_global ['PGE::Util'], 'split'
169 p6rule = compreg 'PGE::Perl6Regex'
170 regex = p6rule('(a)(b)')
172 $P0 = split(regex, "abracadabra")
184 # cperl-indent-level: 4
187 # vim: expandtab shiftwidth=4: