This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Bug fix for charnames::vianame
authorSADAHIRO Tomoyuki <BQW10602@nifty.com>
Tue, 28 May 2002 23:53:39 +0000 (08:53 +0900)
committerJarkko Hietaniemi <jhi@iki.fi>
Tue, 28 May 2002 14:06:42 +0000 (14:06 +0000)
Message-Id: <20020528234907.310A.BQW10602@nifty.com>

p4raw-id: //depot/perl@16837

lib/charnames.pm
lib/charnames.t

index a540d14..af33c86 100644 (file)
@@ -235,7 +235,7 @@ sub vianame
 
     $txt = do "unicore/Name.pl" unless $txt;
 
-    if ($txt =~ m/^([0-9A-F]+)\t\t($arg)/m) {
+    if ($txt =~ m/^([0-9A-F]+)\t\t($arg)$/m) {
         return $vianame{$arg} = hex $1;
     } else {
         return;
index 218cd9a..cfe7642 100644 (file)
@@ -12,7 +12,7 @@ BEGIN {
 
 $| = 1;
 
-print "1..44\n";
+print "1..46\n";
 
 use charnames ':full';
 
@@ -144,7 +144,7 @@ sub to_bytes {
 
 {
     print "not " unless
-       sprintf "%04X\n", charnames::vianame("GOTHIC LETTER AHSA") eq "10330";
+       sprintf("%04X", charnames::vianame("GOTHIC LETTER AHSA")) eq "10330";
     print "ok 19\n";
 
     print "not " if
@@ -159,7 +159,7 @@ sub to_bytes {
     print "ok 21\n";
 
     print "not " unless
-       sprintf "%04X\n", charnames::vianame("GOTHIC LETTER AHSA") eq "10330";
+       sprintf("%04X", charnames::vianame("GOTHIC LETTER AHSA")) eq "10330";
     print "ok 22\n";
 
 }
@@ -235,8 +235,18 @@ print "ok 41\n";
 print "not " unless "\N{U+263A}" eq "\N{WHITE SMILING FACE}";
 print "ok 42\n";
 
+{
+    print "not " unless
+       0x3093 == charnames::vianame("HIRAGANA LETTER N");
+    print "ok 43\n";
+
+    print "not " unless
+       0x0397 == charnames::vianame("GREEK CAPITAL LETTER ETA");
+    print "ok 44\n";
+}
+
 print "not " if defined charnames::viacode(0x110000);
-print "ok 43\n";
+print "ok 45\n";
 
 print "not " if grep { /you asked for U+110000/ } @WARN;
-print "ok 44\n";
+print "ok 46\n";