Debian Codegraph @

t/xe12_boolean.t

raw
1
2 use strict;
3 use Test::More;
4
5 BEGIN { plan tests => 4 };
6
7 BEGIN { $ENV{PERL_JSON_BACKEND} ||= 1; }
8
9 use JSON -support_by_pp;
10
11 SKIP: {
12 skip "can't use JSON::XS.", 4, unless( JSON->backend->is_xs );
13
14 my $json = new JSON;
15 my $bool = $json->allow_nonref->decode('true');
16
17 # it's normal
18 isa_ok( $bool, 'JSON::PP::Boolean' );
19 is( $json->encode([ JSON::true ]), '[true]' );
20
21 # make XS non support flag enable!
22 $bool = $json->allow_singlequote->decode('true');
23
24 isa_ok( $bool, 'JSON::PP::Boolean' );
25 is( $json->encode([ JSON::true ]), '[true]' );
26
27 }
28
29 __END__