xref: /openbsd/gnu/usr.bin/perl/cpan/JSON-PP/t/016_tied.t (revision 4bdff4be)
1# copied over from JSON::XS and modified to use JSON::PP
2
3use strict;
4use warnings;
5use Test::More;
6BEGIN { plan tests => 2 };
7
8BEGIN { $ENV{PERL_JSON_BACKEND} = 0; }
9
10use JSON::PP;
11use Tie::Hash;
12use Tie::Array;
13
14
15my $js = JSON::PP->new;
16
17tie my %h, 'Tie::StdHash';
18%h = (a => 1);
19
20ok ($js->encode (\%h) eq '{"a":1}');
21
22tie my @a, 'Tie::StdArray';
23@a = (1, 2);
24
25ok ($js->encode (\@a) eq '[1,2]');
26