From: Karen Etheridge Date: Wed, 22 Oct 2014 03:59:22 +0000 (-0700) Subject: add more diagnostics in tests X-Git-Tag: v1.002006~2 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=0b694b310e3c4cfb311fe4506dfdf17404c47461;p=p5sagit%2FJSON-MaybeXS.git add more diagnostics in tests Need to figure out for what versions of JSON::XS, Cpanel::JSON::XS we need to skip bool tests e.g. http://www.cpantesters.org/cpan/report/8f76d388-5549-11e4-a43f-fa922836e1c4 http://www.cpantesters.org/cpan/report/6f307bd0-6bfe-1014-bdc4-edd1fea000fb --- diff --git a/Changes b/Changes index 9bd4e29..348a77f 100644 --- a/Changes +++ b/Changes @@ -1,5 +1,8 @@ Revision history for JSON-MaybeXS + - add some additional test diagnostics, to help find bad version combinations + of JSON backends + 1.002005 - 2014-10-12 - fix "can I haz XS?" logic precedence in Makefile.PL - added the ':all' export tag diff --git a/t/cpanel.t b/t/cpanel.t index 44630bc..bc2ec35 100644 --- a/t/cpanel.t +++ b/t/cpanel.t @@ -7,6 +7,8 @@ unless ( eval { require Cpanel::JSON::XS; 1 } ) { plan skip_all => 'No Cpanel::JSON::XS'; } +diag 'Using Cpanel::JSON::XS ', Cpanel::JSON::XS->VERSION; + is( JSON, 'Cpanel::JSON::XS', 'Correct JSON class' ); is( \&encode_json, diff --git a/t/lib/is_bool.pm b/t/lib/is_bool.pm index a2fea95..28fd0cf 100644 --- a/t/lib/is_bool.pm +++ b/t/lib/is_bool.pm @@ -5,6 +5,9 @@ use Test::More; use JSON::MaybeXS; my $data = JSON::MaybeXS->new->decode('{"foo": true, "bar": false, "baz": 1}'); +diag 'true is: ', explain $data->{foo}; +diag 'false is: ', explain $data->{bar}; + ok( JSON::MaybeXS::is_bool($data->{foo}), JSON() . ': true decodes to a bool', diff --git a/t/pp.t b/t/pp.t index 9d1bf06..94dc6ff 100644 --- a/t/pp.t +++ b/t/pp.t @@ -1,10 +1,13 @@ use strict; use warnings FATAL => 'all'; + use Test::Without::Module 'Cpanel::JSON::XS', 'JSON::XS'; use if !eval { require JSON::PP; 1; }, 'Test::More', skip_all => 'No JSON::PP'; use Test::More; use JSON::MaybeXS; +diag 'Using JSON::PP ', JSON::PP->VERSION; + is(JSON, 'JSON::PP', 'Correct JSON class'); is( diff --git a/t/preload_cpanel.t b/t/preload_cpanel.t index b7007d8..80b1e00 100644 --- a/t/preload_cpanel.t +++ b/t/preload_cpanel.t @@ -4,6 +4,8 @@ use if !eval { require Cpanel::JSON::XS; 1; }, 'Test::More', skip_all => 'No Cpa use Test::More; use JSON::MaybeXS; +diag 'Using Cpanel::JSON::XS ', Cpanel::JSON::XS->VERSION; + is(JSON, 'Cpanel::JSON::XS', 'Correct JSON class'); is( diff --git a/t/preload_xs.t b/t/preload_xs.t index f5c94b6..055381c 100644 --- a/t/preload_xs.t +++ b/t/preload_xs.t @@ -1,9 +1,12 @@ use strict; use warnings FATAL => 'all'; + use if !eval { require JSON::XS; 1; }, 'Test::More', skip_all => 'No JSON::XS'; use Test::More; use JSON::MaybeXS; +diag 'Using JSON::XS ', JSON::XS->VERSION; + is( JSON, 'JSON::XS', 'Correct JSON class' ); is( \&encode_json, \&JSON::XS::encode_json, 'Correct encode_json function' ); diff --git a/t/xs.t b/t/xs.t index a254b7e..4a9248d 100644 --- a/t/xs.t +++ b/t/xs.t @@ -9,6 +9,8 @@ unless ( eval { require JSON::XS; 1 } ) { plan skip_all => 'No JSON::XS'; } +diag 'Using JSON::XS ', JSON::XS->VERSION; + is( JSON, 'JSON::XS', 'Correct JSON class' ); is( \&encode_json, \&JSON::XS::encode_json, 'Correct encode_json function' );