5 use File::Temp qw(tempdir);
6 use File::Spec::Functions;
7 my $dir = tempdir( CLEANUP => 1 );
10 # this is because JSON::XS (and Cpanel::JSON::XS) is
11 # the only one which really gets utf8 correct
14 $ENV{JSON_ANY_ORDER} = 'XS CPANEL';
15 $ENV{JSON_ANY_CONFIG} = "utf8=0,canonical=1";
19 'JSON::Any' => 0.01, # skip all if not installed
20 'IO::AtomicFile' => 0.01,
24 use_ok('MooseX::Storage');
33 with Storage( 'format' => 'JSON', 'io' => 'File' );
35 has 'utf8_string' => (
38 default => sub { "ネットスーパー (Internet Shopping)" }
42 my $file = catfile($dir,'temp.json');
46 isa_ok( $foo, 'Foo' );
52 my $foo = Foo->load($file);
56 "ネットスーパー (Internet Shopping)",
57 '... got the string we expected');
66 utf8_string => 'Escritório'
68 isa_ok( $foo, 'Foo' );
74 my $foo = Foo->load($file);
77 ok(utf8::is_utf8($foo->utf8_string), '... the string is still utf8');
81 '... got the string we expected');