Added Module::Pluggable
[pkg-perl] / deb-src / libmodule-pluggable-perl / libmodule-pluggable-perl-3.8 / t / 19can_ok_clobber.t
1 #!/usr/bin/perl
2 use strict; 
3 use warnings;
4 use Data::Dumper;
5 use FindBin;
6 use lib (($FindBin::Bin."/lib")=~/^(.*)$/);
7
8 use Test::More tests=>5;
9
10 #use_ok( 'MyTest' );
11 #diag "Module::Pluggable::VERSION $Module::Pluggable::VERSION";
12
13 my @plugins = MyTest->plugins;
14 my @plugins_after;
15
16 use_ok( 'MyTest::Plugin::Foo' );
17 ok( my $foo = MyTest::Plugin::Foo->new() );
18
19 @plugins_after = MyTest->plugins;
20 is_deeply(
21     \@plugins_after,
22     \@plugins,
23     "plugins haven't been clobbered",
24 );
25
26 can_ok ($foo, 'frobnitz');
27
28 @plugins_after = MyTest->plugins;
29 is_deeply(
30     \@plugins_after,
31     \@plugins,
32     "plugins haven't been clobbered",
33 ) or diag Dumper ;
34
35
36
37 package MyTest;
38
39 use strict;
40 use Module::Pluggable;
41
42
43 sub new {
44     my $class = shift;
45     return bless {}, $class;
46
47 }
48 1;
49
50