This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
charnames.t: Skip testing named sequences if don't exist
authorKarl Williamson <public@khwilliamson.com>
Tue, 27 Mar 2012 03:19:14 +0000 (21:19 -0600)
committerKarl Williamson <public@khwilliamson.com>
Sat, 2 Jun 2012 14:29:13 +0000 (08:29 -0600)
Instead of dying when applied to a Unicode version that doesn't have
named sequences, skip them.

lib/charnames.t

index 8aba9be..b5233de 100644 (file)
@@ -1185,8 +1185,7 @@ is("\N{U+1D0C5}", "\N{BYZANTINE MUSICAL SYMBOL FTHORA SKLIRON CHROMA VASIS}", 'V
         $block = $end_block + 1;
     }
 
-    open $fh, "<", "../../lib/unicore/NamedSequences.txt" or
-        die "Can't open ../../lib/unicore/NamedSequences.txt: $!";
+    if (open my $fh, "<", "../../lib/unicore/NamedSequences.txt") {
     while (<$fh>) {
         chomp;
         s/^\s*#.*//;
@@ -1200,6 +1199,12 @@ is("\N{U+1D0C5}", "\N{BYZANTINE MUSICAL SYMBOL FTHORA SKLIRON CHROMA VASIS}", 'V
         #diag("$name, $utf8");
     }
     close $fh;
+    }
+    else {
+        use Unicode::UCD;
+        die "Can't open ../../lib/unicore/NamedSequences.txt: $!"
+        if pack("C*", split /\./, Unicode::UCD::UnicodeVersion()) ge v4.1.0;
+    }
 
 
     unless ($all_pass) {