| 1 |
# https://rt.cpan.org/Public/Bug/Display.html?id=61708 |
| 2 |
|
| 3 |
use strict; |
| 4 |
use Test::More; |
| 5 |
|
| 6 |
BEGIN { plan tests => 1 }; |
| 7 |
BEGIN { $ENV{PERL_JSON_BACKEND} ||= 1; } |
| 8 |
|
| 9 |
use JSON -support_by_pp; |
| 10 |
#use JSON; # currently it can't pass with -support_by_pp; |
| 11 |
|
| 12 |
|
| 13 |
SKIP: { |
| 14 |
skip "can't use JSON::XS.", 1, unless( JSON->backend->is_xs ); |
| 15 |
|
| 16 |
my $json = JSON->new; |
| 17 |
|
| 18 |
my $res = eval q{ $json->encode( undef ) }; |
| 19 |
my $error = $@; |
| 20 |
|
| 21 |
# JSON::XS/JSON::PP 4.0 allow nonref by default |
| 22 |
if ($json->get_allow_nonref) { |
| 23 |
is $res => 'null'; |
| 24 |
} else { |
| 25 |
like( $error, qr/line 1\./ ); |
| 26 |
} |
| 27 |
} |
| 28 |
|