summaryrefslogtreecommitdiff
path: root/ext/Module-Pluggable/t/13exceptregex.t
diff options
context:
space:
mode:
Diffstat (limited to 'ext/Module-Pluggable/t/13exceptregex.t')
-rw-r--r--ext/Module-Pluggable/t/13exceptregex.t68
1 files changed, 68 insertions, 0 deletions
diff --git a/ext/Module-Pluggable/t/13exceptregex.t b/ext/Module-Pluggable/t/13exceptregex.t
new file mode 100644
index 0000000000..2d842b387f
--- /dev/null
+++ b/ext/Module-Pluggable/t/13exceptregex.t
@@ -0,0 +1,68 @@
+#!perl -wT
+
+use strict;
+use FindBin;
+use lib (($FindBin::Bin."/lib")=~/^(.*)$/);
+use Test::More tests => 10;
+
+{
+ my $foo;
+ ok($foo = MyTest->new());
+
+ my @plugins;
+ my @expected = qw(MyTest::Plugin::Bar MyTest::Plugin::Quux::Foo);
+ ok(@plugins = sort $foo->plugins);
+
+ is_deeply(\@plugins, \@expected);
+
+ @plugins = ();
+
+ ok(@plugins = sort MyTest->plugins);
+ is_deeply(\@plugins, \@expected);
+}
+
+{
+ my $foo;
+ ok($foo = MyTestSub->new());
+
+ my @plugins;
+ my @expected = qw(MyTest::Plugin::Bar MyTest::Plugin::Quux::Foo);
+ ok(@plugins = sort $foo->plugins);
+
+ is_deeply(\@plugins, \@expected);
+
+ @plugins = ();
+
+ ok(@plugins = sort MyTestSub->plugins);
+ is_deeply(\@plugins, \@expected);
+}
+
+package MyTest;
+
+use strict;
+use Module::Pluggable except => qr/MyTest::Plugin::Foo/;
+
+
+
+sub new {
+ my $class = shift;
+ return bless {}, $class;
+
+}
+
+package MyTestSub;
+
+use strict;
+use Module::Pluggable search_path => "MyTest::Plugin";
+
+
+sub new {
+ my $class = shift;
+ my $self = bless {}, $class;
+
+ $self->except(qr/MyTest::Plugin::Foo/);
+
+ return $self;
+}
+1;
+