1#!/usr/bin/perl 2 3use strict; 4use Test::More tests => 4; 5 6BEGIN { 7 $ENV{ PERL_JSON_BACKEND } = $ARGV[0] || 'JSON::backportPP'; 8} 9 10use JSON; 11 12# reported by https://rt.cpan.org/Public/Bug/Display.html?id=68359 13 14eval { JSON->to_json( 5, { allow_nonref => 1 } ) }; 15ok($@); 16 17is( q{"5"}, JSON::to_json( "5", { allow_nonref => 1 } ) ); 18is( q{5}, JSON::to_json( 5, { allow_nonref => 1 } ) ); 19is( q{"JSON"}, JSON::to_json( 'JSON', { allow_nonref => 1 } ) ); 20