summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2019-07-06 11:41:28 +0200
committerYorhel <git@yorhel.nl>2019-07-06 11:45:22 +0200
commit75cf14b9ff122607d3321c009586b24859330102 (patch)
tree7de540b5b95395ea26ea916f172473e79db732c5
parent641a69b5d422b6eabfc45464331e17c00bc35b42 (diff)
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.
-rw-r--r--t/interop.t2
-rw-r--r--t/validate.t2
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;