Data-AnyXfer
view release on metacpan or search on metacpan
t/json/upstream/03_types.t view on Meta::CPAN
BEGIN { $| = 1; print "1..76\n"; }
use utf8;
use Data::AnyXfer::JSON;
our $test;
sub ok($) {
print $_[0] ? "" : "not ", "ok ", ++$test, "\n";
}
ok( !defined Data::AnyXfer::JSON->new->allow_nonref(1)->decode('null') );
ok( Data::AnyXfer::JSON->new->allow_nonref(1)->decode('true') == 1 );
ok( Data::AnyXfer::JSON->new->allow_nonref(1)->decode('false') == 0 );
my $true = Data::AnyXfer::JSON->new->allow_nonref(1)->decode('true');
ok( $true eq 1 );
ok( Data::AnyXfer::JSON::is_bool $true);
t/json/upstream/12_blessed.t view on Meta::CPAN
BEGIN { $| = 1; print "1..16\n"; }
use Data::AnyXfer::JSON;
our $test;
sub ok($;$) {
print $_[0] ? "" : "not ", "ok ", ++$test, "\n";
}
my $o1 = bless { a => 3 }, "XX";
my $o2 = bless \(my $dummy = 1), "YY";
if (eval 'require Hash::Util') {
if ($Hash::Util::VERSION > 0.05) {
Hash::Util::lock_ref_keys($o1);
print "# blessed hash is locked\n";
t/json/upstream/16_tied.t view on Meta::CPAN
BEGIN { $| = 1; print "1..2\n"; }
use Data::AnyXfer::JSON;
use Tie::Hash;
use Tie::Array;
our $test;
sub ok($;$) {
print $_[0] ? "" : "not ", "ok ", ++$test, "\n";
}
my $js = Data::AnyXfer::JSON->new;
tie my %h, 'Tie::StdHash';
%h = (a => 1);
ok ($js->encode (\%h) eq '{"a":1}');
( run in 1.511 second using v1.01-cache-2.11-cpan-5b529ec07f3 )