summaryrefslogtreecommitdiff
path: root/lib/locale.t
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2016-11-28 14:16:18 -0700
committerKarl Williamson <khw@cpan.org>2016-11-28 17:15:24 -0700
commit535a3fb3ec9051c531a7797f1de40cbfc39e3f7f (patch)
treee386cf41b70da73b0f36dbee7b1e66e12ebb80f5 /lib/locale.t
parent83cf869355710e5fa99226ae9c014afdb53a30cf (diff)
downloadperl-535a3fb3ec9051c531a7797f1de40cbfc39e3f7f.tar.gz
lib/locale.t: Don't assume NUL is a control
A test that assumed NUL would be considered a control fails in locales where it isn't considered a control. This was found on FREEBSD, where the locale "hi_IN.ISCII-DEV" is defective (based on the Wikipedia article on ISCII https://en.wikipedia.org/wiki/Indian_Script_Code_for_Information_Interchange). Only the code points 0x09-0x0D are considered controls in this implementation, whereas the article says ISCII is a superset of ASCII, so should have 33 controls, not just 5. (Unrelated to this ticket, but another apparent defect I saw is that this implementation defines 0x91, but the article says that code point is unassigned.)
Diffstat (limited to 'lib/locale.t')
-rw-r--r--lib/locale.t16
1 files changed, 11 insertions, 5 deletions
diff --git a/lib/locale.t b/lib/locale.t
index 9695d86980..2f3123d9be 100644
--- a/lib/locale.t
+++ b/lib/locale.t
@@ -1806,10 +1806,16 @@ foreach my $Locale (@Locale) {
++$locales_test_number;
$test_names{$locales_test_number}
- = 'Verify that \0 sorts before any other control';
- my $ok = $sorted_controls[0] eq "\0";
- report_result($Locale, $locales_test_number, $ok);
- shift @sorted_controls;
+ = 'Skip in locales where \0 is not considered a control;'
+ . ' otherwise verify that \0 sorts before any other control';
+ if ("\0" !~ /[[:cntrl:]]/) {
+ report_result($Locale, $locales_test_number, 1);
+ }
+ else {
+ my $ok = $sorted_controls[0] eq "\0";
+ report_result($Locale, $locales_test_number, $ok);
+ shift @sorted_controls;
+ }
my $lowest_control = $sorted_controls[0];
++$locales_test_number;
@@ -1827,7 +1833,7 @@ foreach my $Locale (@Locale) {
++$locales_test_number;
$test_names{$locales_test_number}
= 'Verify that strings with embedded NUL collate';
- $ok = "a\0a\0a" lt "a${lowest_control}a${lowest_control}a";
+ my $ok = "a\0a\0a" lt "a${lowest_control}a${lowest_control}a";
report_result($Locale, $locales_test_number, $ok);
++$locales_test_number;