diff options
author | Nicholas Clark <nick@ccl4.org> | 2006-04-29 16:07:31 +0000 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2006-04-29 16:07:31 +0000 |
commit | 6e08b83d756ad133b8bc2487444be12cd5bed405 (patch) | |
tree | f0d5770e37fd3e04831ad90b24628a8377652a37 /t | |
parent | d54190f6ca0aac8b08bb59370c53932771933c40 (diff) | |
download | perl-6e08b83d756ad133b8bc2487444be12cd5bed405.tar.gz |
There were more ways to break uc/lc/ucfirst/lcfirst even without
use 'locale'; so test for them too. Correct the skip count.
p4raw-id: //depot/perl@28014
Diffstat (limited to 't')
-rw-r--r-- | t/uni/overload.t | 62 |
1 files changed, 59 insertions, 3 deletions
diff --git a/t/uni/overload.t b/t/uni/overload.t index 38328f1e97..95c916ae0d 100644 --- a/t/uni/overload.t +++ b/t/uni/overload.t @@ -7,7 +7,7 @@ BEGIN { } } -use Test::More tests => 24; +use Test::More tests => 56; package UTF8Toggle; use strict; @@ -43,6 +43,50 @@ foreach my $t ("ASCII", "B\366se") { is (length $u, $length, "length of '$t'"); } +my $u = UTF8Toggle->new("\311"); +my $lc = lc $u; +is (length $lc, 1); +is ($lc, "\311", "E accute -> e accute"); +$lc = lc $u; +is (length $lc, 1); +is ($lc, "\351", "E accute -> e accute"); +$lc = lc $u; +is (length $lc, 1); +is ($lc, "\311", "E accute -> e accute"); + +$u = UTF8Toggle->new("\351"); +my $uc = uc $u; +is (length $uc, 1); +is ($uc, "\351", "e accute -> E accute"); +$uc = uc $u; +is (length $uc, 1); +is ($uc, "\311", "e accute -> E accute"); +$uc = uc $u; +is (length $uc, 1); +is ($uc, "\351", "e accute -> E accute"); + +$u = UTF8Toggle->new("\311"); +$lc = lcfirst $u; +is (length $lc, 1); +is ($lc, "\311", "E accute -> e accute"); +$lc = lcfirst $u; +is (length $lc, 1); +is ($lc, "\351", "E accute -> e accute"); +$lc = lcfirst $u; +is (length $lc, 1); +is ($lc, "\311", "E accute -> e accute"); + +$u = UTF8Toggle->new("\351"); +$uc = ucfirst $u; +is (length $uc, 1); +is ($uc, "\351", "e accute -> E accute"); +$uc = ucfirst $u; +is (length $uc, 1); +is ($uc, "\311", "e accute -> E accute"); +$uc = ucfirst $u; +is (length $uc, 1); +is ($uc, "\351", "e accute -> E accute"); + my $have_setlocale = 0; eval { require POSIX; @@ -52,9 +96,9 @@ eval { SKIP: { if (!$have_setlocale) { - skip "No setlocale", 4; + skip "No setlocale", 24; } elsif (!setlocale(&POSIX::LC_ALL, "en_GB.ISO8859-1")) { - skip "Could not setlocale to en_GB.ISO8859-1", 4; + skip "Could not setlocale to en_GB.ISO8859-1", 24; } else { use locale; my $u = UTF8Toggle->new("\311"); @@ -64,6 +108,9 @@ SKIP: { $lc = lc $u; is (length $lc, 1); is ($lc, "\351", "E accute -> e accute"); + $lc = lc $u; + is (length $lc, 1); + is ($lc, "\351", "E accute -> e accute"); $u = UTF8Toggle->new("\351"); my $uc = uc $u; @@ -72,6 +119,9 @@ SKIP: { $uc = uc $u; is (length $uc, 1); is ($uc, "\311", "e accute -> E accute"); + $uc = uc $u; + is (length $uc, 1); + is ($uc, "\311", "e accute -> E accute"); $u = UTF8Toggle->new("\311"); $lc = lcfirst $u; @@ -80,6 +130,9 @@ SKIP: { $lc = lcfirst $u; is (length $lc, 1); is ($lc, "\351", "E accute -> e accute"); + $lc = lcfirst $u; + is (length $lc, 1); + is ($lc, "\351", "E accute -> e accute"); $u = UTF8Toggle->new("\351"); $uc = ucfirst $u; @@ -88,5 +141,8 @@ SKIP: { $uc = ucfirst $u; is (length $uc, 1); is ($uc, "\311", "e accute -> E accute"); + $uc = ucfirst $u; + is (length $uc, 1); + is ($uc, "\311", "e accute -> E accute"); } } |