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

Side by Side Diff: third_party/JSON/JSON-2.58/t/xe19_xs_and_suportbypp.t

Issue 15736030: Add JSON.pm to third_party (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Check SHA-1 hash 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 #! perl
2
3 # https://rt.cpan.org/Public/Bug/Display.html?id=52847
4
5 use strict;
6 use Test::More;
7
8 BEGIN { plan tests => 2 };
9 BEGIN { $ENV{PERL_JSON_BACKEND} = 1; }
10
11 use JSON -support_by_pp;
12
13 SKIP: {
14 skip "can't use JSON::XS.", 2, unless( JSON->backend->is_xs );
15
16 my $json = JSON->new->allow_barekey;
17
18 for (1..2) {
19 is_deeply( test($json, q!{foo:"foo"}! ), {foo=>'foo'} );
20 JSON->new->allow_singlequote(0);
21 }
22 }
23
24
25 sub test {
26 my ($coder, $str) = @_;
27 my $rv;
28 return $rv if eval { $rv = $coder->decode($str); 1 };
29 chomp( my $e = $@ );
30 return "died with \"$e\"";
31 };
32
33
34
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698