clean up module hiding in tests
[p5sagit/JSON-MaybeXS.git] / t / xs.t
diff --git a/t/xs.t b/t/xs.t
index 2c9243a..405e7f1 100644 (file)
--- a/t/xs.t
+++ b/t/xs.t
@@ -1,19 +1,26 @@
 use strict;
-use warnings FATAL => 'all';
-use if !do { require Cpanel::JSON::XS; 1; }, 'Test::More', skip_all => 'No Cpanel::JSON::XS';
-use Test::More;
+use warnings;
+
+# hide Cpanel::JSON::XS
+use lib map {
+    my $m = $_;
+    sub { return unless $_[1] eq $m; die "Can't locate $m in \@INC (hidden).\n" };
+} qw{Cpanel/JSON/XS.pm};
+
+use Test::More 0.88;
 use JSON::MaybeXS;
 
-is(JSON, 'Cpanel::JSON::XS', 'Correct JSON class');
+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, \&Cpanel::JSON::XS::encode_json,
-  'Correct encode_json function'
-);
+is( \&encode_json, \&JSON::XS::encode_json, 'Correct encode_json function' );
+is( \&decode_json, \&JSON::XS::decode_json, 'Correct encode_json function' );
 
-is(
-  \&decode_json, \&Cpanel::JSON::XS::decode_json,
-  'Correct encode_json function'
-);
+require './t/lib/is_bool.pm';
 
 done_testing;