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

Side by Side Diff: third_party/JSON/JSON-2.59/t/e01_property.t

Issue 15736030: Add JSON.pm to third_party (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix permissions and shebangs 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
« no previous file with comments | « third_party/JSON/JSON-2.59/t/e00_func.t ('k') | third_party/JSON/JSON-2.59/t/e02_bool.t » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1
2 use Test::More;
3 use strict;
4
5 BEGIN { plan tests => 90 };
6
7 BEGIN { $ENV{PERL_JSON_BACKEND} = "JSON::backportPP"; }
8
9 BEGIN {
10 use lib qw(t);
11 use _unicode_handling;
12 }
13
14 use JSON;
15
16 my @simples =
17 qw/utf8 indent canonical space_before space_after allow_nonref shrink allow_ blessed
18 convert_blessed relaxed
19 /;
20
21 if ($JSON::can_handle_UTF16_and_utf8) {
22 unshift @simples, 'ascii';
23 unshift @simples, 'latin1';
24 }
25
26 SKIP: {
27 skip "UNICODE handling is disabale.", 14 unless $JSON::can_handle_UTF16_and_ utf8;
28 }
29
30 my $json = new JSON;
31
32 for my $name (@simples) {
33 my $method = 'get_' . $name;
34 ok(! $json->$method(), $method . ' default');
35 $json->$name();
36 ok($json->$method(), $method . ' set true');
37 $json->$name(0);
38 ok(! $json->$method(), $method . ' set false');
39 $json->$name();
40 ok($json->$method(), $method . ' set true again');
41 }
42
43
44 ok($json->get_max_depth == 512, 'get_max_depth default');
45 $json->max_depth(7);
46 ok($json->get_max_depth == 7, 'get_max_depth set 7 => 7');
47 $json->max_depth();
48 ok($json->get_max_depth != 0, 'get_max_depth no arg');
49
50
51 ok($json->get_max_size == 0, 'get_max_size default');
52 $json->max_size(7);
53 ok($json->get_max_size == 7, 'get_max_size set 7 => 7');
54 $json->max_size();
55 ok($json->get_max_size == 0, 'get_max_size no arg');
56
57
58 for my $name (@simples) {
59 $json->$name();
60 ok($json->property($name), $name);
61 $json->$name(0);
62 ok(! $json->property($name), $name);
63 $json->$name();
64 ok($json->property($name), $name);
65 }
66
67
OLDNEW
« no previous file with comments | « third_party/JSON/JSON-2.59/t/e00_func.t ('k') | third_party/JSON/JSON-2.59/t/e02_bool.t » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698