xref: /openbsd/gnu/usr.bin/perl/cpan/JSON-PP/t/016_tied.t (revision 73471bf0)
1# copied over from JSON::XS and modified to use JSON::PP
2
3use strict;
4use Test::More;
5BEGIN { plan tests => 2 };
6
7BEGIN { $ENV{PERL_JSON_BACKEND} = 0; }
8
9use JSON::PP;
10use Tie::Hash;
11use Tie::Array;
12
13
14my $js = JSON::PP->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