OLD | NEW |
(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 |
OLD | NEW |