1use strict; 2use Test::More; 3BEGIN { plan tests => 2 }; 4 5BEGIN { $ENV{PERL_JSON_BACKEND} = 1; } 6 7use JSON; 8use Tie::Hash; 9use Tie::Array; 10 11SKIP: { 12 skip "can't use JSON::XS.", 2, unless( JSON->backend->is_xs ); 13 14my $js = JSON->new; 15 16tie my %h, 'Tie::StdHash'; 17%h = (a => 1); 18 19ok ($js->encode (\%h) eq '{"a":1}'); 20 21tie my @a, 'Tie::StdArray'; 22@a = (1, 2); 23 24ok ($js->encode (\@a) eq '[1,2]'); 25 26} 27