1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
|
#!/usr/bin/perl
use strict;
use warnings;
use Test::More tests => 40;
my @moose_exports = qw(
extends with
has
before after around
override
augment
super inner
);
{
package Foo;
eval 'use Mouse';
die $@ if $@;
}
can_ok('Foo', $_) for @moose_exports;
{
package Foo;
eval 'no Mouse';
die $@ if $@;
}
ok(!Foo->can($_), '... Foo can no longer do ' . $_) for @moose_exports;
# and check the type constraints as well
my @moose_type_constraint_exports = qw(
type subtype as where message
coerce from via
enum
find_type_constraint
);
{
package Bar;
eval 'use Mouse::Util::TypeConstraints';
die $@ if $@;
}
can_ok('Bar', $_) for @moose_type_constraint_exports;
{
package Bar;
eval 'no Mouse::Util::TypeConstraints';
die $@ if $@;
}
ok(!Bar->can($_), '... Bar can no longer do ' . $_) for @moose_type_constraint_exports;
|