Created
October 16, 2018 13:41
-
-
Save tomredsky/bb79502c91c9a51ff8217c303d3c1763 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/opt/perl5/bin/perl | |
use v5.22; | |
use warnings; | |
use Type::Tiny; | |
use Types::Standard qw(Maybe ArrayRef Int); | |
my $Type = "Type::Tiny"->new( | |
name => 'OrderBy', | |
constraint => sub { Maybe[ArrayRef[Int]] }, | |
message => sub { "$_ is not an array of integers" }, | |
); | |
my %tests = ( | |
1 => [qw(1 2 3 4 )], | |
2 => [qw( foo bar)], | |
); | |
for my $t (sort keys %tests ) { | |
say $tests{$t}; | |
$Type->assert_valid($tests{$t}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment