f2d6a59e266b65f5fd02e239495ddb586eacc02b
[p5sagit/JSON-MaybeXS.git] / xt / json_pm.t
1 use strict;
2 use warnings;
3 use Test::More;
4
5 unless ( eval { require JSON; 1 } ) {
6     plan skip_all => 'No JSON';
7 }
8
9 my $data = JSON()->new->decode('{"foo": true, "bar": false, "baz": 1}');
10
11 ok(
12     JSON::is_bool($data->{foo}),
13     'JSON.pm: true decodes to a bool',
14 );
15 ok(
16     JSON::is_bool($data->{bar}),
17     'JSON.pm:: false decodes to a bool',
18 );
19 ok(
20     !JSON::is_bool($data->{baz}),
21     'JSON.pm: int does not decode to a bool',
22 );
23
24 done_testing;