4 if ($ENV{'PERL_CORE'}){
10 use Test::More tests => 24;
15 use overload '""' => 'stringify';
19 return bless [shift, 0], $class;
24 $self->[1] = ! $self->[1];
26 utf8::downgrade($self->[0]);
28 utf8::upgrade($self->[0]);
36 foreach my $t ("ASCII", "B\366se") {
37 my $length = length $t;
39 my $u = UTF8Toggle->new($t);
40 is (length $u, $length, "length of '$t'");
41 is (length $u, $length, "length of '$t'");
42 is (length $u, $length, "length of '$t'");
43 is (length $u, $length, "length of '$t'");
46 my $have_setlocale = 0;
49 import POSIX ':locale_h';
54 if (!$have_setlocale) {
55 skip "No setlocale", 4;
56 } elsif (!setlocale(&POSIX::LC_ALL, "en_GB.ISO8859-1")) {
57 skip "Could not setlocale to en_GB.ISO8859-1", 4;
60 my $u = UTF8Toggle->new("\311");
63 is ($lc, "\351", "E accute -> e accute");
66 is ($lc, "\351", "E accute -> e accute");
68 $u = UTF8Toggle->new("\351");
71 is ($uc, "\311", "e accute -> E accute");
74 is ($uc, "\311", "e accute -> E accute");
76 $u = UTF8Toggle->new("\311");
79 is ($lc, "\351", "E accute -> e accute");
82 is ($lc, "\351", "E accute -> e accute");
84 $u = UTF8Toggle->new("\351");
87 is ($uc, "\311", "e accute -> E accute");
90 is ($uc, "\311", "e accute -> E accute");