summaryrefslogtreecommitdiff
path: root/chromium/third_party/JSON/JSON-2.59/t/e02_bool.t
blob: 12b7eb0d5d1c8c6845d2a3bb02fa980e405b4481 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32

use strict;

use Test::More;
use strict;

BEGIN { plan tests => 11 };

BEGIN { $ENV{PERL_JSON_BACKEND} = "JSON::backportPP"; }

use JSON;

my $json = new JSON;


is($json->encode([!1]),   '[""]');
is($json->encode([!!2]), '["1"]');

is($json->encode([ 'a' eq 'b'  ]), '[""]');
is($json->encode([ 'a' eq 'a'  ]), '["1"]');

is($json->encode([ ('a' eq 'b') + 1  ]), '[1]');
is($json->encode([ ('a' eq 'a') + 1  ]), '[2]');

ok(JSON::true eq 'true');
ok(JSON::true eq  '1');
ok(JSON::true == 1);
isa_ok(JSON::true, JSON->backend . '::Boolean');
isa_ok(JSON::true, 'JSON::Boolean');