Re: [PATCH] Mac OS X 10.4.4 (Darwin 8.4.0) still does not fix locale issue
[p5sagit/p5-mst-13.2.git] / lib / utf8.t
index 33cd596..81ebc22 100644 (file)
@@ -37,7 +37,7 @@ no utf8; # Ironic, no?
 #
 #
 
-plan tests => 143;
+plan tests => 150;
 
 {
     # bug id 20001009.001
@@ -409,3 +409,33 @@ SKIP: {
     ok( utf8::is_utf8($b), " utf8::is_utf8 beyond"); # $b stays in UTF-8.
     ok( utf8::is_utf8($c), " utf8::is_utf8 unicode");
 }
+
+{
+    eval {utf8::encode("£")};
+    like($@, qr/^Modification of a read-only value attempted/,
+        "utf8::encode should refuse to touch read-only values");
+}
+
+{
+    my $a = "456\xb6";
+    utf8::upgrade($a);
+
+    my $b = "123456\xb6";
+    $b =~ s/^...//;
+    utf8::upgrade($b);
+    is($b, $a, "utf8::upgrade OffsetOK");
+}
+
+{
+    fresh_perl_like ('use utf8; utf8::moo()',
+                    qr/Undefined subroutine utf8::moo/, {stderr=>1},
+                   "Check Carp is loaded for AUTOLOADing errors")
+}
+
+{
+    # failure of is_utf8_char() without NATIVE_TO_UTF on EBCDIC (0260..027F)
+    ok(utf8::valid(chr(0x250)), "0x250");
+    ok(utf8::valid(chr(0x260)), "0x260");
+    ok(utf8::valid(chr(0x270)), "0x270");
+    ok(utf8::valid(chr(0x280)), "0x280");
+}