This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
uni/class.t: Add test
authorKarl Williamson <public@khwilliamson.com>
Sat, 19 Nov 2011 18:17:17 +0000 (11:17 -0700)
committerKarl Williamson <public@khwilliamson.com>
Fri, 13 Jan 2012 16:58:32 +0000 (09:58 -0700)
This new test makes sure that a regular expression that forward
references a user-defined property works.

t/uni/class.t

index 40dbd9f..144ae43 100644 (file)
@@ -4,7 +4,12 @@ BEGIN {
     require "test.pl";
 }
 
-plan tests => 10;
+plan tests => 11;
+
+my $str = join "", map latin1_to_native(chr($_)), 0x20 .. 0x6F;
+
+is(($str =~ /(\p{IsMyUniClass}+)/)[0], '0123456789:;<=>?@ABCDEFGHIJKLMNO',
+                                'user-defined class compiled before defined');
 
 sub IsMyUniClass {
   <<END;
@@ -50,8 +55,6 @@ sub test_regexp ($$) {
 
 use strict;
 
-my $str = join "", map latin1_to_native(chr($_)), 0x20 .. 0x6F;
-
 # make sure it finds built-in class
 is(($str =~ /(\p{Letter}+)/)[0], 'ABCDEFGHIJKLMNOPQRSTUVWXYZ');
 is(($str =~ /(\p{l}+)/)[0], 'ABCDEFGHIJKLMNOPQRSTUVWXYZ');