71ad5eaa8f2019c5b3a590a498f85c35d4efce36
[p5sagit/Function-Parameters.git] / t / foreign / Method-Signatures / typeload_notypes.t
1 #!perl
2
3 use strict;
4 use warnings FATAL => 'all';
5
6 use Test::More;
7
8
9 {
10     package Foo::Bar;
11
12     use strict;
13     use warnings;
14
15     use Function::Parameters qw(:strict);
16
17     method new ($class:) { bless {}, $class; }
18
19     # not using a type here, so we won't expect Moose *or* Mouse to get loaded
20     method foo1 ($bar) {};
21 }
22
23 my $foobar = Foo::Bar->new;
24
25 # at this point, neither Mouse nor Moose should be loaded
26
27 is $INC{'Mouse/Util/TypeConstraints.pm'}, undef, 'no type checking module loaded before method call';
28 is $INC{'Moose/Util/TypeConstraints.pm'}, undef, 'no type checking module loaded before method call';
29
30
31 $foobar->foo1(42);
32
33 # _still_ should have no Moose and no Mouse, because we haven't requested any type checking
34
35 is $INC{'Mouse/Util/TypeConstraints.pm'}, undef, 'no type checking module loaded before method call';
36 is $INC{'Moose/Util/TypeConstraints.pm'}, undef, 'no type checking module loaded before method call';
37
38
39 done_testing;