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