summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorKarl Williamson <khw@khw-desktop.(none)>2010-07-18 12:28:14 -0600
committerRafael Garcia-Suarez <rgs@consttype.org>2010-09-16 15:09:26 +0200
commitc99e91e919b4bb89bab7829a9026ee01b1fff2a1 (patch)
tree5b069e6bd24b358e42e94e01b97424d5a09d9bfc /t
parenteb06eac93f0120092363c6c7ba87bb7054e76844 (diff)
downloadperl-c99e91e919b4bb89bab7829a9026ee01b1fff2a1.tar.gz
Fix /[\8]/ to not match NULL; give correct warning
8 and 9 are not treated as alphas in parsing as opposed to illegal octals. This also adds tests to verify that 1-3 digits work in char classes. I created an isOCTAL macro in case that lookup gets moved to a bit field, as I plan to do later, for speed.
Diffstat (limited to 't')
-rw-r--r--t/lib/warnings/regcomp13
-rw-r--r--t/re/re_tests15
2 files changed, 28 insertions, 0 deletions
diff --git a/t/lib/warnings/regcomp b/t/lib/warnings/regcomp
index 6bc684568b..98280f61f4 100644
--- a/t/lib/warnings/regcomp
+++ b/t/lib/warnings/regcomp
@@ -237,3 +237,16 @@ Missing braces on \o{} in regex; marked by <-- HERE in m/[\o <-- HERE ]/ at - li
$a = qr/[\o{}]/;
EXPECT
Number with no digits in regex; marked by <-- HERE in m/[\o{} <-- HERE ]/ at - line 2.
+########
+# regcomp.c [S_regclass]
+use warnings 'regexp' ;
+$a = qr/[\8\9]/;
+$a = qr/[\_\0]/; # Should have no warnings on this and the remainder of this test
+$a = qr/[\07]/;
+$a = qr/[\006]/;
+$a = qr/[\0005]/;
+no warnings 'regexp' ;
+$a = qr/[\8\9]/;
+EXPECT
+Unrecognized escape \8 in character class passed through in regex; marked by <-- HERE in m/[\8 <-- HERE \9]/ at - line 3.
+Unrecognized escape \9 in character class passed through in regex; marked by <-- HERE in m/[\8\9 <-- HERE ]/ at - line 3.
diff --git a/t/re/re_tests b/t/re/re_tests
index 36a2f4cee5..1c45583f43 100644
--- a/t/re/re_tests
+++ b/t/re/re_tests
@@ -1467,4 +1467,19 @@ abc\N{def - c - \\N{NAME} must be resolved by the lexer
[a\o{400}] \x{100} y $& \x{100}
[a\o{1000}] \x{200} y $& \x{200}
+# The below was inserting a NULL into the character class.
+[\8\9] \000 n - -
+[\8\9] 8 y $& 8
+[\8\9] 9 y $& 9
+
+# Verify that reads 1-3 octal digits, and that \_ works in char class
+[\0] \000 y $& \000
+[\07] \007 y $& \007
+[\07] 7\000 n - -
+[\006] \006 y $& \006
+[\006] 6\000 n - -
+[\0005] \0005 y $& \000
+[\0005] 5\000 y $& 5
+[\_] _ y $& _
+
# vim: softtabstop=0 noexpandtab