Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(355)

Side by Side Diff: trunk/src/third_party/JSON/JSON-2.59/t/xe03_bool2.t

Issue 16539003: Revert 205057 "Add JSON.pm to third_party" (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 use Test::More;
2
3 BEGIN { plan tests => 26 };
4
5 BEGIN { $ENV{PERL_JSON_BACKEND} = 1; }
6 use JSON;
7
8 SKIP: {
9 skip "can't use JSON::XS.", 26, unless( JSON->backend->is_xs );
10
11 is(to_json([JSON::true]), q|[true]|);
12 is(to_json([JSON::false]), q|[false]|);
13 is(to_json([JSON::null]), q|[null]|);
14
15 my $jsontext = q|[true,false,null]|;
16 my $obj = from_json($jsontext);
17
18 isa_ok($obj->[0], 'JSON::Boolean');
19 isa_ok($obj->[1], 'JSON::Boolean');
20 ok(!defined $obj->[2], 'null is undef');
21
22 ok($obj->[0] == 1);
23 ok($obj->[0] != 0);
24 ok($obj->[1] == 0);
25 ok($obj->[1] != 1);
26
27 ok($obj->[0] eq 'true', 'eq true');
28 ok($obj->[0] ne 'false', 'ne false');
29 ok($obj->[1] eq 'false', 'eq false');
30 ok($obj->[1] ne 'true', 'ne true');
31
32 ok($obj->[0] eq $obj->[0]);
33 ok($obj->[0] ne $obj->[1]);
34
35 ok(JSON::true eq 'true');
36 ok(JSON::true ne 'false');
37 ok(JSON::true ne 'null');
38 ok(JSON::false eq 'false');
39 ok(JSON::false ne 'true');
40 ok(JSON::false ne 'null');
41 ok(!defined JSON::null);
42
43 is(from_json('[true]' )->[0], JSON::true);
44 is(from_json('[false]')->[0], JSON::false);
45 is(from_json('[null]' )->[0], JSON::null);
46
47 }
OLDNEW
« no previous file with comments | « trunk/src/third_party/JSON/JSON-2.59/t/xe02_bool.t ('k') | trunk/src/third_party/JSON/JSON-2.59/t/xe04support_by_pp.t » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698