Commit | Line | Data |
3f7169a2 |
1 | #!perl -w |
2 | |
3 | use strict; |
4 | use FindBin; |
183ac38d |
5 | use lib (($FindBin::Bin."/lib")=~/^(.*)$/); |
3f7169a2 |
6 | use Test::More tests => 6; |
7 | |
8 | my $foo; |
9 | ok($foo = MyTest->new()); |
10 | |
11 | |
12 | |
13 | my @plugins; |
14 | ok(@plugins = sort $foo->booga(nork => 'fark')); |
15 | is(ref $plugins[0],'MyTest::Extend::Plugin::Bar'); |
16 | is($plugins[0]->nork,'fark'); |
17 | |
18 | |
19 | @plugins = (); |
20 | eval { @plugins = $foo->wooga( nork => 'fark') }; |
21 | is($@, ''); |
22 | is(scalar(@plugins),0); |
23 | |
24 | |
25 | package MyTest; |
26 | use File::Spec::Functions qw(catdir); |
27 | use strict; |
28 | use FindBin; |
183ac38d |
29 | use lib (($FindBin::Bin."/lib")=~/^(.*)$/); |
3f7169a2 |
30 | use Module::Pluggable (search_path => ["MyTest::Extend::Plugin"], sub_name => 'booga', instantiate => 'new'); |
31 | use Module::Pluggable (search_path => ["MyTest::Extend::Plugin"], sub_name => 'wooga', instantiate => 'nosomuchmethod'); |
32 | |
33 | |
34 | sub new { |
35 | my $class = shift; |
36 | return bless {}, $class; |
37 | |
38 | } |
39 | 1; |
40 | |