summaryrefslogtreecommitdiff
path: root/t/base
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2013-07-11 22:46:22 -0700
committerFather Chrysostomos <sprout@cpan.org>2013-07-12 23:07:04 -0700
commit8b12970a83017badfde9752dbd1480e612591839 (patch)
treec91cf0db82bb5a68c767c1c3e51bf4a407759bfe /t/base
parent13d0d101a48a328c651a6ca3c89e392bc65f9e1f (diff)
downloadperl-8b12970a83017badfde9752dbd1480e612591839.tar.gz
t/base/lex.t: Test pyoq with comment before delim
perlop says: There can be whitespace between the operator and the quoting characters, except when C<#> is being used as the quoting character. C<q#foo#> is parsed as the string C<foo>, while C<q #foo#> is the operator C<q> followed by a comment. Its argument will be taken from the next line. But I do not find tests for this anywhere. Here are some.
Diffstat (limited to 't/base')
-rw-r--r--t/base/lex.t45
1 files changed, 44 insertions, 1 deletions
diff --git a/t/base/lex.t b/t/base/lex.t
index b1c4a09992..7ef753807b 100644
--- a/t/base/lex.t
+++ b/t/base/lex.t
@@ -1,6 +1,6 @@
#!./perl
-print "1..85\n";
+print "1..93\n";
$x = 'x';
@@ -400,3 +400,46 @@ print "ok 84 - call a function in package v10::foo\n";
print "not " unless (1?v65:"bar") eq 'A';
print "ok 85 - colon detection after vstring does not break ? vstring :\n";
+
+# Test pyoq ops with comments before the first delim
+q # comment
+ "b"#
+ eq 'b' or print "not ";
+print "ok 86 - q <comment> <newline> ...\n";
+qq # comment
+ "b"#
+ eq 'b' or print "not ";
+print "ok 87 - qq <comment> <newline> ...\n";
+qw # comment
+ "b"#
+ [0] eq 'b' or print "not ";
+print "ok 88 - qw <comment> <newline> ...\n";
+"b" =~ m # comment
+ "b"#
+ or print "not ";
+print "ok 89 - m <comment> <newline> ...\n";
+qr # comment
+ "b"#
+ eq qr/b/ or print "not ";
+print "ok 90 - qr <comment> <newline> ...\n";
+$_ = "a";
+s # comment
+ [a] #
+ [b] #
+ ;
+print "not " unless $_ eq 'b';
+print "ok 91 - s <comment> <newline> ...\n";
+$_ = "a";
+tr # comment
+ [a] #
+ [b] #
+ ;
+print "not " unless $_ eq 'b';
+print "ok 92 - tr <comment> <newline> ...\n";
+$_ = "a";
+y # comment
+ [a] #
+ [b] #
+ ;
+print "not " unless $_ eq 'b';
+print "ok 93 - y <comment> <newline> ...\n";