Commit | Line | Data |
---|---|---|
3f7169a2 RGS |
1 | #!perl -w |
2 | ||
3 | use strict; | |
4 | use FindBin; | |
5 | use lib "$FindBin::Bin/lib"; | |
6 | use Test::More tests => 3; | |
7 | ||
8 | my $foo; | |
9 | ok($foo = MyTest->new()); | |
10 | ||
11 | my @plugins; | |
12 | my @expected = qw(MyTest::Extend::Plugin::Bar MyTest::Plugin::Bar MyTest::Plugin::Foo MyTest::Plugin::Quux::Foo); | |
13 | ||
14 | push @plugins, $foo->plugins; | |
15 | push @plugins, $foo->foo; | |
16 | ||
17 | @plugins = sort @plugins; | |
18 | is_deeply(\@plugins, \@expected); | |
19 | ||
20 | @plugins = (); | |
21 | ||
22 | push @plugins, MyTest->plugins; | |
23 | push @plugins, MyTest->foo; | |
24 | @plugins = sort @plugins; | |
25 | is_deeply(\@plugins, \@expected); | |
26 | ||
27 | ||
28 | ||
29 | package MyTest; | |
30 | ||
31 | use strict; | |
32 | use Module::Pluggable; | |
33 | use Module::Pluggable ( search_path => [ "MyTest::Extend::Plugin" ] , sub_name => 'foo' ); | |
34 | ||
35 | ||
36 | sub new { | |
37 | my $class = shift; | |
38 | return bless {}, $class; | |
39 | ||
40 | } | |
41 | ||
42 | ||
43 | 1; | |
44 |