Skip to content

Commit

Permalink
Add tests for Qw, Qx and Qww. One more test for qx to check how two b…
Browse files Browse the repository at this point in the history
…ackslashes are interpreted (#182)

* Add tests for Qw, Qx and Qww. One more test for qx to check how two backslashes are interpreted

* Compare that the result of Qx[echo '\'] and qx[echo '\\'] are equal so it works on Windows as well as POSIX shell

* Compare \\ and \\\\ not \ and \\

* Compare Qx[echo '\\\\'] and qx[echo '\\\\\\\\'] not \\ and \\\\
  • Loading branch information
samcv authored and zoffixznet committed Nov 15, 2016
1 parent 1f3cadd commit f1581ac
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions S02-literals/quoting.t
@@ -1,6 +1,6 @@
use v6;
use Test;
plan 185;
plan 189;

my $foo = "FOO";
my $bar = "BAR";
Expand Down Expand Up @@ -336,7 +336,7 @@ Note that non-ASCII tests are kept in quoting-unicode.t
is("\x41", "A", 'hex interpolation - \x41 is "A"');
is("\o101", "A", 'octal interpolation - \o101 is also "A"' );
is("\c@", "\0", 'Unicode code point "@" converts correctly to "\0"');
is("\cA", chr(1), 'Unicode "A" is #1!');
is("\cZ", chr(26), 'Unicode "Z" is chr 26 (or \c26)');
Expand Down Expand Up @@ -497,6 +497,9 @@ Hello, World
is(Qf[$alpha &zeta()], '$alpha 42', 'Qf');
is(Qb[$alpha\t$beta], '$alpha $beta', 'Qb');
is(Qc[{1+1}], 2, 'Qc');
is(Qw["a b" \ {1+1}], ('"a', 'b"', '\\', '{1+1}'), 'Qw');
is(Q:w[a b \ {1+1}], ('a', 'b', '\\', '{1+1}'), 'Q:w');
is(Qww["a b" \ {1+1}], ( 'a b', '\\', '{1+1}'), 'Qww');
}
# L<S02/Backslashing/All other quoting forms (including standard single quotes)>
Expand Down Expand Up @@ -524,6 +527,8 @@ Hello, World
my $var = 'world';
is qx/echo world/.chomp, "world", 'qx';
is qqx/echo $var/.chomp, "world", 'qqx';
is Qx[echo '\\\\'] cmp qx[echo '\\\\\\\\'], Same, 'Qx treats backslash literally, qx treats \\ as one backslash';
# RT #78874
is qx/echo world/.trans('wd' => 'WD').chomp, "WorlD", "qx doesn't return a Parrot string";
}
Expand Down

0 comments on commit f1581ac

Please sign in to comment.