1#!perl -T 2 3use Test::More; 4 5BEGIN { 6 7 # Count who's installed 8 my @order = qw(JSON::XS JSON JSON::DWIW JSON::Syck); 9 my $count = scalar grep { eval "require $_"; not $@; } @order; 10 11 unless ($count) { # need at least one 12 plan skip_all => "Can't find a JSON package."; 13 exit; 14 } 15 16 # if we're here we have *something* that will work 17 plan tests => 7; 18 use_ok('JSON::Any'); 19} 20 21diag("Testing JSON::Any $JSON::Any::VERSION, Perl $], $^X"); 22can_ok( JSON::Any, qw(new) ); 23can_ok( JSON::Any, qw(objToJson jsonToObj) ); 24can_ok( JSON::Any, qw(to_json from_json ) ); 25can_ok( JSON::Any, qw(Dump Load ) ); 26can_ok( JSON::Any, qw(encode decode ) ); 27 28is( JSON::Any->objToJson( { foo => 'bar' } ), q[{"foo":"bar"}] ); 29