version 1.0401
[p5sagit/Function-Parameters.git] / t / types_custom_3.t
CommitLineData
e7c6de2c 1#!perl
2use warnings FATAL => 'all';
3use strict;
4
5use Test::More tests => 8;
6
7{
8 package TX;
9
10 sub check { 1 }
11
12 our $obj;
13 BEGIN { $obj = bless {}, 'TX'; }
14}
15
16use Function::Parameters {
17 fun => {
f7651a6e 18 strict => 1,
e7c6de2c 19 reify_type => sub {
20 my ($type, $package) = @_;
21 if ($package ne $type) {
22 my (undef, $file, $line) = @_;
23 diag "";
24 diag "! $file : $line";
25 }
26 is $package, $type;
27 $TX::obj
28 },
29 },
30};
31
32fun f1(main $x) {}
33fun Asdf::f1(main $x) {}
34
35{
36 package Foo::Bar::Baz;
37
38 fun f1(Foo::Bar::Baz $x) {}
39 fun Ghjk::f1(Foo::Bar::Baz $x) {}
40
41 package AAA;
42 fun f1(AAA $x) {}
43 fun main::f2(AAA $x) {}
44}
45
46fun f3(main $x) {}
47fun Ghjk::f2(main $x) {}