$JSON_Class is not JSON::XS if version < 3.0
[p5sagit/JSON-MaybeXS.git] / t / xs.t
1 use strict;
2 use warnings;
3
4 # hide Cpanel::JSON::XS
5 use lib map {
6     my $m = $_;
7     sub { return unless $_[1] eq $m; die "Can't locate $m in \@INC (hidden).\n" };
8 } qw{Cpanel/JSON/XS.pm};
9
10 use Test::More 0.88;
11 use JSON::MaybeXS;
12
13 use Test::Needs { 'JSON::XS' => '3.0' };  # load first, before JSON::MaybeXS
14 diag 'Using JSON::XS ', JSON::XS->VERSION;
15
16 is( JSON, 'JSON::XS', 'Correct JSON class' );
17
18 is( \&encode_json, \&JSON::XS::encode_json, 'Correct encode_json function' );
19 is( \&decode_json, \&JSON::XS::decode_json, 'Correct encode_json function' );
20
21 require './t/lib/is_bool.pm';
22
23 done_testing;