summaryrefslogtreecommitdiff
path: root/t/uni
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2019-05-16 15:47:20 -0600
committerKarl Williamson <khw@cpan.org>2019-05-16 22:09:00 -0600
commit4531f512e1cacd3b3f8417f033e8318384b78d6b (patch)
tree132961192bb9aabe2927bf3be90a04ab683c28ef /t/uni
parent0bc0f7314abbd796013eefd04638fd914aaf2cca (diff)
downloadperl-4531f512e1cacd3b3f8417f033e8318384b78d6b.tar.gz
PATCH: [perl #133860] 5.30 regression
These bugs stem from trying to compile a user-defined \p{IsProperty} before the data for the property is available. In the past, a bug used the wrong package for IsProperty, and it wasn't found, so its expansion was delayed until runtime. But that bug got fixed, and now it finds the property and thinks its deliberately empty, at compile time. This is a change in behavior, even if it is fixing a bug, where the real problem is unobvious. The solution adopted in this commit is to defer all empty properties at pattern compilation time. If they are still empty at runtime, that's what the expansion will be.
Diffstat (limited to 't/uni')
-rw-r--r--t/uni/class.t19
1 files changed, 18 insertions, 1 deletions
diff --git a/t/uni/class.t b/t/uni/class.t
index 37392aabed..572a538004 100644
--- a/t/uni/class.t
+++ b/t/uni/class.t
@@ -5,7 +5,7 @@ BEGIN {
skip_all_without_unicode_tables();
}
-plan tests => 11;
+plan tests => 12;
my $str = join "", map { chr utf8::unicode_to_native($_) } 0x20 .. 0x6F;
@@ -88,5 +88,22 @@ $str = "[\x{038B}\x{038C}\x{038D}]";
is(($str =~ /(\p{InGreek}+)/)[0], "\x{038B}\x{038C}\x{038D}");
+{ # [perl #133860], compilation before data for it is available
+ package Foo;
+
+ sub make {
+ my @lines;
+ while( my($c) = splice(@_,0,1) ) {
+ push @lines, sprintf("%04X", $c);
+ }
+ return join "\n", @lines;
+ }
+
+ my @characters = ( ord("a") );
+ sub IsProperty { make(@characters); };
+
+ main::like('a', qr/\p{IsProperty}/, "foo");
+}
+
# The other tests that are based on looking at the generated files are now
# in t/re/uniprops.t