Debian Codegraph @

t/rt_122270_is_bool_for_obsolete_xs_boolean.t

raw
1 # copied over from JSON::XS and modified to use JSON
2
3 use strict;
4 use warnings;
5 use Test::More;
6 BEGIN { plan tests => 10 };
7
8 BEGIN { $ENV{PERL_JSON_BACKEND} ||= "JSON::backportPP"; }
9
10 use utf8;
11 use JSON;
12
13 SKIP: {
14 skip "no JSON::XS < 3", 5 unless eval { require JSON::XS; JSON::XS->VERSION < 3 };
15
16 my $false = JSON::XS::false();
17 ok (JSON::is_bool $false);
18 ok (++$false == 1);
19 ok (!JSON::is_bool $false);
20 ok (!JSON::is_bool "JSON::Boolean");
21 ok (!JSON::is_bool {}); # GH-34
22 }
23
24 SKIP: {
25 skip "no Types::Serialiser 0.01", 5 unless eval { require JSON::XS; JSON::XS->VERSION(3.00); require Types::Serialiser; Types::Serialiser->VERSION == 0.01 };
26
27 my $false = JSON::XS::false();
28 ok (JSON::is_bool $false);
29 ok (++$false == 1);
30 ok (!JSON::is_bool $false);
31 ok (!JSON::is_bool "JSON::Boolean");
32 ok (!JSON::is_bool {}); # GH-34
33 }