diff options
author | David Mitchell <davem@iabyn.com> | 2011-01-16 14:16:20 +0000 |
---|---|---|
committer | David Mitchell <davem@iabyn.com> | 2011-01-16 14:16:20 +0000 |
commit | d658a8a81c4f311bef688fd51df924a424429f14 (patch) | |
tree | c90aa43119f05a7732d7f1fac94f8c0eae753002 /t/uni/class.t | |
parent | 95a517db36c4d56cf2a5e6103e3235de4c1c38f8 (diff) | |
download | perl-d658a8a81c4f311bef688fd51df924a424429f14.tar.gz |
restrict \p{IsUserDefined} to In\w+ and In\w+
In L<perlunicode/"User-Defined Character Properties">, it says you can
create custom properties by defining subroutines whose names begin with
"In" or "Is". However, perl doesn't actually enforce that naming
restriction, so \p{foo::bar} will call foo::Bar() if it exists.
This commit finally enforces this convention. Note that this broke a
number of existing tests for properties, since they didn't always use an
Is/In prefix.
Diffstat (limited to 't/uni/class.t')
-rw-r--r-- | t/uni/class.t | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/t/uni/class.t b/t/uni/class.t index fedec4cdfe..40dbd9f299 100644 --- a/t/uni/class.t +++ b/t/uni/class.t @@ -6,13 +6,13 @@ BEGIN { plan tests => 10; -sub MyUniClass { +sub IsMyUniClass { <<END; 0030 004F END } -sub Other::Class { +sub Other::IsClass { <<END; 0040 005F END @@ -20,8 +20,8 @@ END sub A::B::Intersection { <<END; -+main::MyUniClass -&Other::Class ++main::IsMyUniClass +&Other::IsClass END } @@ -57,10 +57,10 @@ is(($str =~ /(\p{Letter}+)/)[0], 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'); is(($str =~ /(\p{l}+)/)[0], 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'); # make sure it finds user-defined class -is(($str =~ /(\p{MyUniClass}+)/)[0], '0123456789:;<=>?@ABCDEFGHIJKLMNO'); +is(($str =~ /(\p{IsMyUniClass}+)/)[0], '0123456789:;<=>?@ABCDEFGHIJKLMNO'); # make sure it finds class in other package -is(($str =~ /(\p{Other::Class}+)/)[0], '@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_'); +is(($str =~ /(\p{Other::IsClass}+)/)[0], '@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_'); # make sure it finds class in other OTHER package is(($str =~ /(\p{A::B::Intersection}+)/)[0], '@ABCDEFGHIJKLMNO'); |