diff options
Diffstat (limited to 'cpan/JSON-PP/t/016_tied.t')
-rw-r--r-- | cpan/JSON-PP/t/016_tied.t | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/cpan/JSON-PP/t/016_tied.t b/cpan/JSON-PP/t/016_tied.t new file mode 100644 index 0000000000..2763415817 --- /dev/null +++ b/cpan/JSON-PP/t/016_tied.t @@ -0,0 +1,23 @@ +# copied over from JSON::PP::XS and modified to use JSON::PP + +use strict; +use Test::More; +BEGIN { plan tests => 2 }; + +BEGIN { $ENV{PERL_JSON_BACKEND} = 0; } + +use JSON::PP; +use Tie::Hash; +use Tie::Array; + +my $js = JSON::PP->new; + +tie my %h, 'Tie::StdHash'; +%h = (a => 1); + +ok ($js->encode (\%h) eq '{"a":1}'); + +tie my @a, 'Tie::StdArray'; +@a = (1, 2); + +ok ($js->encode (\@a) eq '[1,2]'); |