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

Side by Side Diff: trunk/src/third_party/JSON/JSON-2.59/t/xe05_indent_length.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 strict;
2 use Test::More;
3 BEGIN { plan tests => 7 };
4
5 BEGIN { $ENV{PERL_JSON_BACKEND} = 1; }
6
7 use JSON -support_by_pp;
8
9 SKIP: {
10 skip "can't use JSON::XS.", 7, unless( JSON->backend->is_xs );
11
12 my $json = new JSON;
13
14
15 is($json->indent_length(2)->encode([1,{foo => 'bar'}, "1", "/"]), qq|[1,{"foo":" bar"},"1","/"]|);
16
17 is($json->indent->encode([1,{foo => 'bar'}, "1", "/"]), qq|[
18 1,
19 {
20 "foo":"bar"
21 },
22 "1",
23 "/"
24 ]
25 |);
26
27
28 is($json->escape_slash(1)->pretty->indent_length(2)->encode([1,{foo => 'bar'}, " 1", "/"]), qq|[
29 1,
30 {
31 "foo" : "bar"
32 },
33 "1",
34 "\\/"
35 ]
36 |);
37
38
39 is($json->escape_slash(1)->pretty->indent_length(3)->encode([1,{foo => 'bar'}, " 1", "/"]), qq|[
40 1,
41 {
42 "foo" : "bar"
43 },
44 "1",
45 "\\/"
46 ]
47 |);
48
49 is($json->escape_slash(1)->pretty->indent_length(15)->encode([1,{foo => 'bar'}, "1", "/"]), qq|[
50 1,
51 {
52 "foo" : "bar"
53 },
54 "1",
55 "\\/"
56 ]
57 |);
58
59
60 is($json->indent_length(0)->encode([1,{foo => 'bar'}, "1", "/"]), qq|[
61 1,
62 {
63 "foo" : "bar"
64 },
65 "1",
66 "\\/"
67 ]
68 |);
69
70 is($json->indent(0)->space_before(0)->space_after(0)->escape_slash(0)
71 ->encode([1,{foo => 'bar'}, "1", "/"]), qq|[1,{"foo":"bar"},"1","/"]|);
72
73
74 }
75
76
OLDNEW
« no previous file with comments | « trunk/src/third_party/JSON/JSON-2.59/t/xe04support_by_pp.t ('k') | trunk/src/third_party/JSON/JSON-2.59/t/xe08_decode.t » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698