Skip to content

Instantly share code, notes, and snippets.

@tomredsky
Created October 16, 2018 13:41
Show Gist options
  • Save tomredsky/bb79502c91c9a51ff8217c303d3c1763 to your computer and use it in GitHub Desktop.
Save tomredsky/bb79502c91c9a51ff8217c303d3c1763 to your computer and use it in GitHub Desktop.
#!/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