Assorted 2.15 fixes.
[p5sagit/p5-mst-13.2.git] / ext / Encode / t / Encode.t
index 63e913a..528f75f 100644 (file)
@@ -143,6 +143,9 @@ chop $a;
 ok(  is_utf8($a)); # weird but true: an empty UTF-8 string
 
 # non-string arguments
-ok(decode(latin1 => bless {}, "x"), undef);
-ok(encode(utf8   => bless {}, "x"), undef);
-
+package Encode::Dummy;
+use overload q("") => sub { $_[0]->[0] };
+sub new { my $class = shift; bless [ @_  ] => $class }
+package main;
+ok(decode(latin1 => Encode::Dummy->new("foobar")), "foobar");
+ok(encode(utf8   => Encode::Dummy->new("foobar")), "foobar");