7 use File::Temp qw(tempdir);
8 use File::Spec::Functions;
9 my $dir = tempdir( CLEANUP => 1 );
12 'JSON::Any' => 0.01, # skip all if not installed
13 'IO::AtomicFile' => 0.01,
18 # this is because JSON::XS is
19 # the only one which really gets
23 $ENV{JSON_ANY_ORDER} = qw(XS);
24 $ENV{JSON_ANY_CONFIG} = "utf8=1";
27 use_ok('MooseX::Storage');
37 with Storage( 'format' => 'JSON', 'io' => 'File' );
39 has 'utf8_string' => (
42 default => sub { "ネットスーパー (Internet Shopping)" }
46 my $file = catfile($dir,'temp.json');
50 isa_ok( $foo, 'Foo' );
56 my $foo = Foo->load($file);
60 "ネットスーパー (Internet Shopping)",
61 '... got the string we expected');
70 utf8_string => 'Escritório'
72 isa_ok( $foo, 'Foo' );
78 my $foo = Foo->load($file);
81 ok(utf8::is_utf8($foo->utf8_string), '... the string is still utf8');
85 '... got the string we expected');