This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Re-enable the setlocale() tests for Windows XP onwards
[perl5.git] / t / Module_Pluggable / 12only.t
CommitLineData
3f7169a2
RGS
1#!perl -w
2
3use strict;
4use FindBin;
5use lib "$FindBin::Bin/lib";
6use Test::More tests => 10;
7
8{
9 my $foo;
10 ok($foo = MyTest->new());
11
12 my @plugins;
13 my @expected = qw(MyTest::Plugin::Foo);
14 ok(@plugins = sort $foo->plugins);
15 is_deeply(\@plugins, \@expected);
16
17 @plugins = ();
18
19 ok(@plugins = sort MyTest->plugins);
20 is_deeply(\@plugins, \@expected);
21}
22
23{
24 my $foo;
25 ok($foo = MyTestSub->new());
26
27 my @plugins;
28 my @expected = qw(MyTest::Plugin::Foo);
29 ok(@plugins = sort $foo->plugins);
30 is_deeply(\@plugins, \@expected);
31
32 @plugins = ();
33
34 ok(@plugins = sort MyTestSub->plugins);
35 is_deeply(\@plugins, \@expected);
36}
37
38package MyTest;
39
40use strict;
41use Module::Pluggable only => "MyTest::Plugin::Foo";
42
43
44sub new {
45 my $class = shift;
46 return bless {}, $class;
47
48}
49
50package MyTestSub;
51
52use strict;
53use Module::Pluggable search_path => "MyTest::Plugin";
54
55
56sub new {
57 my $class = shift;
58 my $self = bless {}, $class;
59
60 $self->only("MyTest::Plugin::Foo");
61
62 return $self;
63}
641;