summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2016-08-31 17:05:45 -0600
committerKarl Williamson <khw@cpan.org>2016-08-31 17:22:06 -0600
commitc333712c4a550eeb3146b964d8508f772e294a49 (patch)
treef1aa51d4a6c5b053e2d1ad3cefee58c33514d6e7 /t
parent2cb86ab37f2186d7853067c7afb2938963f7ac3e (diff)
downloadperl-c333712c4a550eeb3146b964d8508f772e294a49.tar.gz
PATCH: [perl #129122] regex sets syntax error
This was caused by two statements being in the wrong order. One should save something on the stack before changing it, not after. However fixing this led to the discovery of another bug in which an error case was failed to be detected.
Diffstat (limited to 't')
-rw-r--r--t/re/reg_mesg.t6
-rw-r--r--t/re/regex_sets.t15
2 files changed, 18 insertions, 3 deletions
diff --git a/t/re/reg_mesg.t b/t/re/reg_mesg.t
index 5ca9b8ff00..52bec7a473 100644
--- a/t/re/reg_mesg.t
+++ b/t/re/reg_mesg.t
@@ -221,8 +221,8 @@ my @death =
'/(?[ \x{} ])/' => 'Number with no digits {#} m/(?[ \x{}{#} ])/',
'/(?[ \cK + ) ])/' => 'Unexpected \')\' {#} m/(?[ \cK + ){#} ])/',
'/(?[ \cK + ])/' => 'Incomplete expression within \'(?[ ])\' {#} m/(?[ \cK + {#}])/',
- '/(?[ ( ) ])/' => 'Incomplete expression within \'(?[ ])\' {#} m/(?[ ( ) {#}])/',
- '/(?[[0]+()+])/' => 'Incomplete expression within \'(?[ ])\' {#} m/(?[[0]+()+{#}])/',
+ '/(?[ ( ) ])/' => 'Incomplete expression within \'(?[ ])\' {#} m/(?[ ( ){#} ])/',
+ '/(?[[0]+()+])/' => 'Incomplete expression within \'(?[ ])\' {#} m/(?[[0]+(){#}+])/',
'/(?[ \p{foo} ])/' => 'Can\'t find Unicode property definition "foo" {#} m/(?[ \p{foo}{#} ])/',
'/(?[ \p{ foo = bar } ])/' => 'Can\'t find Unicode property definition "foo = bar" {#} m/(?[ \p{ foo = bar }{#} ])/',
'/(?[ \8 ])/' => 'Unrecognized escape \8 in character class {#} m/(?[ \8{#} ])/',
@@ -267,7 +267,7 @@ my @death =
'/(?[\ -!])/' => 'Incomplete expression within \'(?[ ])\' {#} m/(?[\ -!{#}])/', # [perl #126180]
'/(?[\ ^!])/' => 'Incomplete expression within \'(?[ ])\' {#} m/(?[\ ^!{#}])/', # [perl #126180]
'/(?[\ |!])/' => 'Incomplete expression within \'(?[ ])\' {#} m/(?[\ |!{#}])/', # [perl #126180]
- '/(?[()-!])/' => 'Incomplete expression within \'(?[ ])\' {#} m/(?[()-!{#}])/', # [perl #126204]
+ '/(?[()-!])/' => 'Incomplete expression within \'(?[ ])\' {#} m/(?[(){#}-!])/', # [perl #126204]
'/(?[!()])/' => 'Incomplete expression within \'(?[ ])\' {#} m/(?[!(){#}])/', # [perl #126404]
'/\w{/' => 'Unescaped left brace in regex is illegal here {#} m/\w{{#}/',
'/\q{/' => 'Unescaped left brace in regex is illegal here {#} m/\q{{#}/',
diff --git a/t/re/regex_sets.t b/t/re/regex_sets.t
index 544d670dc6..810e30100b 100644
--- a/t/re/regex_sets.t
+++ b/t/re/regex_sets.t
@@ -184,6 +184,21 @@ for my $char ("٠", "٥", "٩") {
'qr/qr/(?[ ! ( ! (\w)])/');
}
+{ # RT #129122
+ my $pat = '(?[ ( [ABC] - [B] ) + ( [abc] - [b] ) + [def] ])';
+ like("A", qr/$pat/, "'A' matches /$pat/");
+ unlike("B", qr/$pat/, "'B' doesn't match /$pat/");
+ like("C", qr/$pat/, "'C' matches /$pat/");
+ unlike("D", qr/$pat/, "'D' doesn't match /$pat/");
+ like("a", qr/$pat/, "'a' matches /$pat/");
+ unlike("b", qr/$pat/, "'b' doesn't match /$pat/");
+ like("c", qr/$pat/, "'c' matches /$pat/");
+ like("d", qr/$pat/, "'d' matches /$pat/");
+ like("e", qr/$pat/, "'e' matches /$pat/");
+ like("f", qr/$pat/, "'f' matches /$pat/");
+ unlike("g", qr/$pat/, "'g' doesn't match /$pat/");
+}
+
done_testing();
1;