add more diagnostics in tests
[p5sagit/JSON-MaybeXS.git] / t / lib / is_bool.pm
1 use strict;
2 use warnings;
3
4 use Test::More;
5 use JSON::MaybeXS;
6
7 my $data = JSON::MaybeXS->new->decode('{"foo": true, "bar": false, "baz": 1}');
8 diag 'true is: ', explain $data->{foo};
9 diag 'false is: ', explain $data->{bar};
10
11 ok(
12     JSON::MaybeXS::is_bool($data->{foo}),
13     JSON() . ': true decodes to a bool',
14 );
15 ok(
16     JSON::MaybeXS::is_bool($data->{bar}),
17     JSON() . ': false decodes to a bool',
18 );
19 ok(
20     !JSON::MaybeXS::is_bool($data->{baz}),
21     JSON() . ': int does not decode to a bool',
22 );
23
24 1;