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