File: isa-mooish.t

package info (click to toggle)
libmoosex-meta-typeconstraint-mooish-perl 0.001-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid, trixie
  • size: 240 kB
  • sloc: perl: 95; makefile: 2
file content (24 lines) | stat: -rw-r--r-- 684 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
use strict;
use warnings;

# de minimus testing

use Test::More;
use Test::Moose::More 0.017;
use Test::Fatal;

use aliased 'Moose::Meta::TypeConstraint'                    => 'TypeConstraint';
use aliased 'MooseX::Meta::TypeConstraint::Mooish'           => 'MooishTC';
use aliased 'MooseX::TraitFor::Meta::TypeConstraint::Mooish' => 'TraitFor';

my $tc = MooishTC->new(
    constraint => sub { die if $_[0] ne '5' },
);
isa_ok $tc, MooishTC;
ok $tc->has_original_constraint => 'has an original constraint';
ok $tc->mooish                  => 'is mooish';

ok  $tc->check(5)      => 'constraint passes with 5';
ok !$tc->check('five') => 'constraint fails with "five"';

done_testing;