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

Side by Side Diff: trunk/src/third_party/JSON/JSON-2.59/t/11_pc_expo.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 # copied over from JSON::PC and modified to use JSON
2 # copied over from JSON::XS and modified to use JSON
3
4 use Test::More;
5 use strict;
6 BEGIN { plan tests => 8 };
7
8 BEGIN { $ENV{PERL_JSON_BACKEND} = "JSON::backportPP"; }
9
10 use JSON;
11
12 #########################
13 my ($js,$obj);
14 my $pc = new JSON;
15
16 $js = q|[-12.34]|;
17 $obj = $pc->decode($js);
18 is($obj->[0], -12.34, 'digit -12.34');
19 $js = $pc->encode($obj);
20 is($js,'[-12.34]', 'digit -12.34');
21
22 $js = q|[-1.234e5]|;
23 $obj = $pc->decode($js);
24 is($obj->[0], -123400, 'digit -1.234e5');
25 $js = $pc->encode($obj);
26 is($js,'[-123400]', 'digit -1.234e5');
27
28 $js = q|[1.23E-4]|;
29 $obj = $pc->decode($js);
30 is($obj->[0], 0.000123, 'digit 1.23E-4');
31 $js = $pc->encode($obj);
32
33 if ( $js =~ /\[1/ ) { # for 5.6.2 on Darwin 8.10.0
34 like($js, qr/[1.23[eE]-04]/, 'digit 1.23E-4');
35 }
36 else {
37 is($js,'[0.000123]', 'digit 1.23E-4');
38 }
39
40
41
42 $js = q|[1.01e+67]|; # 30 -> 67 ... patched by H.Merijn Brand
43 $obj = $pc->decode($js);
44 is($obj->[0], 1.01e+67, 'digit 1.01e+67');
45 $js = $pc->encode($obj);
46 like($js,qr/\[1.01[Ee]\+0?67\]/, 'digit 1.01e+67');
47
OLDNEW
« no previous file with comments | « trunk/src/third_party/JSON/JSON-2.59/t/10_pc_keysort.t ('k') | trunk/src/third_party/JSON/JSON-2.59/t/12_blessed.t » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698