File: json_pm.t

package info (click to toggle)
libjson-maybexs-perl 1.003008-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 152 kB
  • ctags: 7
  • sloc: perl: 95; makefile: 2
file content (24 lines) | stat: -rw-r--r-- 450 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
use strict;
use warnings;
use Test::More;

unless ( eval { require JSON; 1 } ) {
    plan skip_all => 'No JSON';
}

my $data = JSON->new->decode('{"foo": true, "bar": false, "baz": 1}');

ok(
    JSON::is_bool($data->{foo}),
    'JSON.pm: true decodes to a bool',
);
ok(
    JSON::is_bool($data->{bar}),
    'JSON.pm:: false decodes to a bool',
);
ok(
    !JSON::is_bool($data->{baz}),
    'JSON.pm: int does not decode to a bool',
);

done_testing;