actually load JSON::MaybeXS in JSON.pm bool test
[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 use JSON::MaybeXS;
10
11 my $data = JSON()->new->decode('{"foo": true, "bar": false, "baz": 1}');
12
13 ok(
14     JSON::is_bool($data->{foo}),
15     'JSON.pm: true decodes to a bool',
16 );
17 ok(
18     JSON::is_bool($data->{bar}),
19     'JSON.pm:: false decodes to a bool',
20 );
21 ok(
22     !JSON::is_bool($data->{baz}),
23     'JSON.pm: int does not decode to a bool',
24 );
25
26 done_testing;