diff options
author | Karl Williamson <public@khwilliamson.com> | 2012-12-30 20:28:20 -0700 |
---|---|---|
committer | Karl Williamson <public@khwilliamson.com> | 2012-12-31 11:03:28 -0700 |
commit | baa71cfd7d0dc1450df3a6e8b46877d839f20bb1 (patch) | |
tree | a82d6c76a90deea18835298ee2b893ef2a1e0dd3 /lib/locale.t | |
parent | 15bbd6a21e6c90e6a96bc7545cf952eab62bb3aa (diff) | |
download | perl-baa71cfd7d0dc1450df3a6e8b46877d839f20bb1.tar.gz |
locale.t: Add tests for [:upper:], [:lower:]
If our uc() and lc() functions are working properly, and the locale is
properly set up, things that are uppercase and not lowercase should
match [:upper:], and vice-versa. This adds tests for that.
Diffstat (limited to 'lib/locale.t')
-rw-r--r-- | lib/locale.t | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/lib/locale.t b/lib/locale.t index 800824fd0e..36544d1a8f 100644 --- a/lib/locale.t +++ b/lib/locale.t @@ -762,6 +762,47 @@ foreach $Locale (@Locale) { debug "# lower = ", join("", sort keys %lower ), "\n"; debug "# BoThCaSe = ", join("", sort keys %BoThCaSe), "\n"; + my @failures; + foreach my $x (sort keys %UPPER) { + my $ok; + if ($is_utf8_locale) { + use locale ':not_characters'; + $ok = $x =~ /[[:upper:]]/; + } + else { + use locale; + $ok = $x =~ /[[:upper:]]/; + } + push @failures, $x unless $ok; + } + my $message = ""; + $locales_test_number++; + $test_names{$locales_test_number} = 'Verify that /[[:upper:]]/ matches sieved uppercase characters.'; + $message = 'Failed for ' . join ", ", @failures if @failures; + tryneoalpha($Locale, $locales_test_number, scalar @failures == 0, $message); + + $message = ""; + undef @failures; + + foreach my $x (sort keys %lower) { + my $ok; + if ($is_utf8_locale) { + use locale ':not_characters'; + $ok = $x =~ /[[:lower:]]/; + } + else { + use locale; + $ok = $x =~ /[[:lower:]]/; + } + push @failures, $x unless $ok; + } + + $locales_test_number++; + $test_names{$locales_test_number} = 'Verify that /[[:lower:]]/ matches sieved lowercase characters.'; + $message = 'Failed for ' . join ", ", @failures if @failures; + tryneoalpha($Locale, $locales_test_number, scalar @failures == 0, $message); + $message = ""; + { # Find the alphabetic characters that are not considered alphabetics # in the default (C) locale. |