OLD | NEW |
(Empty) | |
| 1 |
| 2 # https://rt.cpan.org/Public/Bug/Display.html?id=52847 |
| 3 |
| 4 use strict; |
| 5 use Test::More; |
| 6 |
| 7 BEGIN { plan tests => 2 }; |
| 8 BEGIN { $ENV{PERL_JSON_BACKEND} = 1; } |
| 9 |
| 10 use JSON -support_by_pp; |
| 11 |
| 12 SKIP: { |
| 13 skip "can't use JSON::XS.", 2, unless( JSON->backend->is_xs ); |
| 14 |
| 15 my $json = JSON->new->allow_barekey; |
| 16 |
| 17 for (1..2) { |
| 18 is_deeply( test($json, q!{foo:"foo"}! ), {foo=>'foo'} ); |
| 19 JSON->new->allow_singlequote(0); |
| 20 } |
| 21 } |
| 22 |
| 23 |
| 24 sub test { |
| 25 my ($coder, $str) = @_; |
| 26 my $rv; |
| 27 return $rv if eval { $rv = $coder->decode($str); 1 }; |
| 28 chomp( my $e = $@ ); |
| 29 return "died with \"$e\""; |
| 30 }; |
| 31 |
| 32 |
| 33 |
OLD | NEW |