Skip to content

Commit

Permalink
get test passing
Browse files Browse the repository at this point in the history
  • Loading branch information
tobyink committed Aug 18, 2020
1 parent e70cd53 commit 5875514
Showing 1 changed file with 16 additions and 12 deletions.
28 changes: 16 additions & 12 deletions t/08enum.t
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ the same terms as the Perl 5 programming language system itself.

use strict;
use warnings;
use Test::More tests => 21;
use Test::More;

use_ok('Type::Tiny::XS');

Expand All @@ -39,14 +39,18 @@ ok !$check->([]) => 'no []';
ok !$check->("") => 'no ""';
ok !$check->(undef) => 'no undef';

my $quoted_check = Type::Tiny::XS::get_coderef_for('Enum["a b", "c, d", "-\""]');

ok $quoted_check->("a b") => 'yes "a b"';
ok $quoted_check->("c, d") => 'yes "c, d"';
ok $quoted_check->("-\"") => 'yes "-\""';
ok !$quoted_check->("quux") => 'no "quux"';
ok !$quoted_check->("FOO") => 'no "FOO"';
ok !$quoted_check->({}) => 'no {}';
ok !$quoted_check->([]) => 'no []';
ok !$quoted_check->("") => 'no ""';
ok !$quoted_check->(undef) => 'no undef';
if ( eval { require Type::Parser } ) {
my $quoted_check = Type::Tiny::XS::get_coderef_for('Enum["a b", "c, d", "-\""]');

ok $quoted_check->("a b") => 'yes "a b"';
ok $quoted_check->("c, d") => 'yes "c, d"';
ok $quoted_check->("-\"") => 'yes "-\""';
ok !$quoted_check->("quux") => 'no "quux"';
ok !$quoted_check->("FOO") => 'no "FOO"';
ok !$quoted_check->({}) => 'no {}';
ok !$quoted_check->([]) => 'no []';
ok !$quoted_check->("") => 'no ""';
ok !$quoted_check->(undef) => 'no undef';
}

done_testing;

0 comments on commit 5875514

Please sign in to comment.