1use strict; 2use warnings FATAL => 'all'; 3 4use Test::More; 5 6use Encode qw(encode decode find_encoding); 7use Encode::Encoder qw(encoder); 8 9local %Encode::ExtModule = %Encode::Config::ExtModule; 10 11my @names = Encode->encodings(':all'); 12 13plan tests => 1 + 4 * @names; 14 15my $emptyutf8; 16eval { my $c = encoder($emptyutf8)->utf8; }; 17ok(!$@,"crashed encoding undef variable ($@)"); 18 19for my $name (@names) { 20 my $enc = find_encoding($name); 21 is($enc->encode(undef), undef, "find_encoding('$name')->encode(undef) returns undef"); 22 is($enc->decode(undef), undef, "find_encoding('$name')->decode(undef) returns undef"); 23 is(encode($name, undef), undef, "encode('$name', undef) returns undef"); 24 is(decode($name, undef), undef, "decode('$name', undef) returns undef"); 25} 26