From 75cf14b9ff122607d3321c009586b24859330102 Mon Sep 17 00:00:00 2001 From: Yorhel Date: Sat, 6 Jul 2019 11:41:28 +0200 Subject: Fix tests TBH I'm not sure why some tests failed on loading Cpanel::JSON::XS::Type, did they not have a recent enough version of Cpanel::JSON::XS installed or is my eval-skip-thing not working? ...so I'm not entirely sure if this fixes it. --- t/interop.t | 2 +- t/validate.t | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/t/interop.t b/t/interop.t index acb3fb0..bd7c7c9 100644 --- a/t/interop.t +++ b/t/interop.t @@ -81,7 +81,7 @@ subtest 'JSON::XS coercion', sub { }; subtest 'Cpanel::JSON::XS coercion', sub { - eval { require Cpanel::JSON::XS; 1 } or plan skip_all => 'Cpanel::JSON::XS not installed'; + eval { require Cpanel::JSON::XS; require Cpanel::JSON::XS::Type; 1 } or return plan skip_all => 'Cpanel::JSON::XS not installed or too old'; my @extra = ( [ { type => 'num' }, '10', '10.0' ], ); diff --git a/t/validate.t b/t/validate.t index 82f979d..dbb1582 100644 --- a/t/validate.t +++ b/t/validate.t @@ -140,7 +140,7 @@ t { ascii => 1 }, "a\nb", "a\nb", { validation => 'ascii', got => "a\nb" }; # custom validations t { hex => 1 }, 'DeadBeef', 'DeadBeef', undef; -t { hex => 1 }, 'x', 'x', { validation => 'hex', error => { validation => 'regex', regex => '(?^i:^[0-9a-f]*$)', got => 'x' } }; +t { hex => 1 }, 'x', 'x', { validation => 'hex', error => { validation => 'regex', regex => "$validations{hex}{regex}", got => 'x' } }; t { prefix => 'a' }, 'abc', 'abc', undef; t { prefix => 'a' }, 'cba', 'cba', { validation => 'prefix', error => { validation => 'func', result => '' } }; t { bool => 1 }, 'abc', 1, undef; -- cgit v1.2.3