}
}
-use Test::More tests => 24;
+use Test::More tests => 56;
package UTF8Toggle;
use strict;
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;
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");
$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;
$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;
$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;
$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");
}
}