1use strict; 2# use utf8; 3use lib "t/lib"; 4use Test::More tests => 23; 5use Test::Data::Visitor::Encode; 6use Encode; 7 8BEGIN 9{ 10 use_ok("Data::Visitor::Encode"); 11} 12 13{ 14 use utf8; 15 16 # hashref 17 encode_utf8_ok( { "日本語" => "あいうえお" }, "encode_utf8 on hashref" ); 18 19 # arrayref 20 encode_utf8_ok( [ "日本語", "あいうえお" ], "encode_utf8 on arrayref" ); 21 22 # scalarref 23 encode_utf8_ok( \"日本語", "encode_utf8 on scalarref" ); 24 25 encode_utf8_ok( bless({ "日本語" => "あいえうお" }, "Hoge"), "encode_utf8 on object" ); 26} 27 28{ 29 # hashref 30 decode_utf8_ok( { "日本語" => "あいうえお" }, "decode_utf8 on hashref" ); 31 32 # arrayref 33 decode_utf8_ok( [ "日本語", "あいうえお" ], "decode_utf8 on arrayref" ); 34 35 # scalarref 36 decode_utf8_ok( \"日本語", "decode_utf8 on scalarref" ); 37 38 decode_utf8_ok( bless({ "日本語" => "あいえうお" }, "Hoge"), "decode_utf8 on object" ); 39} 40 41