File: e02_bool.t

package info (click to toggle)
libjson-perl 2.07-1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 408 kB
  • ctags: 134
  • sloc: perl: 1,815; makefile: 44
file content (33 lines) | stat: -rw-r--r-- 618 bytes parent folder | download | duplicates (2)
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
33
#!/usr/bin/perl -w

use strict;

use Test::More;
use strict;

BEGIN { plan tests => 11 };

BEGIN { $ENV{PERL_JSON_BACKEND} = 0; }

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');