xref: /openbsd-src/gnu/usr.bin/perl/cpan/JSON-PP/t/rt_122270_old_xs_boolean.t (revision f2a19305cfc49ea4d1a5feb55cd6c283c6f1e031)
1# copied over from JSON::XS and modified to use JSON::PP
2
3use strict;
4use warnings;
5use Test::More;
6BEGIN { plan tests => 10 };
7
8BEGIN { $ENV{PERL_JSON_BACKEND} = 0; }
9
10use utf8;
11use JSON::PP;
12
13SKIP: {
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::PP::is_bool $false);
18    ok (++$false == 1);
19    ok (!JSON::PP::is_bool $false);
20    ok (!JSON::PP::is_bool "JSON::PP::Boolean");
21    ok (!JSON::PP::is_bool {}); # GH-34
22}
23
24SKIP: {
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::PP::is_bool $false);
29    ok (++$false == 1);
30    ok (!JSON::PP::is_bool $false);
31    ok (!JSON::PP::is_bool "JSON::PP::Boolean");
32    ok (!JSON::PP::is_bool {}); # GH-34
33}
34