summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorKarl Williamson <public@khwilliamson.com>2013-01-18 21:58:10 -0700
committerKarl Williamson <public@khwilliamson.com>2013-01-19 09:57:53 -0700
commit902994e45aafa5c63ac8bf2219075daf29139b3c (patch)
treefe0282064d4457174f60becf2c8818e09d575680 /t
parent7e62f75cb6326421c6dade1c6ca08206084d7348 (diff)
downloadperl-902994e45aafa5c63ac8bf2219075daf29139b3c.tar.gz
Extend strictness for qr/(?[ \N{} ])/
This recently added regex syntax imposes stricter rules on parsing than normal. However, this did not include parsing \N{} constructs that occur within it. This commit does that, making fatal the warnings that come from \N{} I will add to perldiag the newly added messages along with the others for (?[ ]) before 5.18 ships
Diffstat (limited to 't')
-rw-r--r--t/porting/diag.t2
-rw-r--r--t/re/pat_advanced.t3
-rw-r--r--t/re/reg_mesg.t2
3 files changed, 7 insertions, 0 deletions
diff --git a/t/porting/diag.t b/t/porting/diag.t
index 13f1811eb3..7355151dc9 100644
--- a/t/porting/diag.t
+++ b/t/porting/diag.t
@@ -658,3 +658,5 @@ Operation "%s" returns its argument for UTF-16 surrogate U+%X
Unicode surrogate U+%X is illegal in UTF-8
UTF-16 surrogate U+%X
False [] range "%s" in regex; marked by <-- HERE in m/%s/
+\N{} in character class restricted to one character in regex; marked by <-- HERE in m/%s/
+Zero length \N{} in regex; marked by <-- HERE in m/%s/
diff --git a/t/re/pat_advanced.t b/t/re/pat_advanced.t
index a411220c7a..60ae9d6a42 100644
--- a/t/re/pat_advanced.t
+++ b/t/re/pat_advanced.t
@@ -1014,6 +1014,9 @@ sub run_tests {
ok "\N{LONG-STR}" =~ /^\N{LONG-STR}$/, 'Verify that long string works';
ok "\N{LONG-STR}" =~ /^\N{LONG-STR}$/i, 'Verify under folding that long string works';
+ eval '/(?[[\N{EMPTY-STR}]])/';
+ ok $@ && $@ =~ /Zero length \\N\{}/;
+
undef $w;
eval q [is("\N{TOO MANY SPACES}", "TOO MANY SPACES", "Multiple spaces in character name works")];
like ($w, qr/A sequence of multiple spaces in a charnames alias definition is deprecated/, "... but returns a deprecation warning");
diff --git a/t/re/reg_mesg.t b/t/re/reg_mesg.t
index 14e9aceee2..30bc2d6354 100644
--- a/t/re/reg_mesg.t
+++ b/t/re/reg_mesg.t
@@ -147,7 +147,9 @@ my @death =
'm/(?[[\w-x]])/' => 'False [] range "\w-" in regex; marked by {#} in m/(?[[\w-{#}x]])/',
'm/(?[[a-\pM]])/' => 'False [] range "a-\pM" in regex; marked by {#} in m/(?[[a-\pM{#}]])/',
'm/(?[[\pM-x]])/' => 'False [] range "\pM-" in regex; marked by {#} in m/(?[[\pM-{#}x]])/',
+ 'm/(?[[\N{LATIN CAPITAL LETTER A WITH MACRON AND GRAVE}]])/' => '\N{} in character class restricted to one character in regex; marked by {#} in m/(?[[\N{U+100.300{#}}]])/',
);
+# Tests involving a user-defined charnames translator are in pat_advanced.t
##
## Key-value pairs of code/error of code that should have non-fatal warnings.