[svn:parrot] r40046 - in branches/ops_pct/compilers/nqp: src/Grammar t
bacek at svn.parrot.org
bacek at svn.parrot.org
Mon Jul 13 11:41:43 UTC 2009
Author: bacek
Date: Mon Jul 13 11:41:42 2009
New Revision: 40046
URL: https://trac.parrot.org/parrot/changeset/40046
Log:
[nqp] Fix quoting of multi-words. Add more tests
Modified:
branches/ops_pct/compilers/nqp/src/Grammar/Actions.pir
branches/ops_pct/compilers/nqp/t/30-interpolate.t
Modified: branches/ops_pct/compilers/nqp/src/Grammar/Actions.pir
==============================================================================
--- branches/ops_pct/compilers/nqp/src/Grammar/Actions.pir Mon Jul 13 11:25:15 2009 (r40045)
+++ branches/ops_pct/compilers/nqp/src/Grammar/Actions.pir Mon Jul 13 11:41:42 2009 (r40046)
@@ -992,7 +992,7 @@
quote_concat_list:
$P1 = get_hll_global ['PAST'], 'Op'
- past = $P1.'new'('name'=>'list', 'pasttype'=>'call', 'node'=>match)
+ past = $P1.'new'('name'=>'infix:,', 'pasttype'=>'call', 'node'=>match)
.local pmc it
it = iter $P0
iter_loop:
Modified: branches/ops_pct/compilers/nqp/t/30-interpolate.t
==============================================================================
--- branches/ops_pct/compilers/nqp/t/30-interpolate.t Mon Jul 13 11:25:15 2009 (r40045)
+++ branches/ops_pct/compilers/nqp/t/30-interpolate.t Mon Jul 13 11:41:42 2009 (r40046)
@@ -1,20 +1,33 @@
#!./parrot nqp.pbc
-# Iterpolation. Cherry-picked from Perl 6 spectest.
+# Iterpolation and quoting. Cherry-picked from Perl 6 spectest.
-plan(4);
+plan(7);
# interpolating into double quotes results in a Str
my $a := 1;
-say("ok $a");
+ok("foo $a bar" == "foo 1 bar", "Scalar interpolated in double-quotes");
$a++;
-say(qq<ok $a>);
+ok(q<ok $a> == "ok 2", "Scalar interpolated in q<>");
# Multi-line
$a++;
my $b := $a++;
-say(qq<
-ok $b
-ok $a
->);
+ok(qq<
+foo $b
+bar $a
+> == '
+foo 3
+bar 4
+', 'Multi-line qq<> works');
+
+# Word quoting.
+my @list := qw{ foo bar baz };
+ok( + at list == 3, 'qw produced 3 words');
+
+ at list := <foo bar>;
+ok( + at list == 2, '<> produced 2 words');
+ok( @list[0] == 'foo', 'First is "foo"');
+ok( @list[1] == 'bar', 'Second is "bar"');
+
More information about the parrot-commits
mailing list