This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Upgrade to Module::Pluggable 3.7
[perl5.git] / t / Module_Pluggable / 21editor_junk.t
1 #!perl -w
2
3 use Test::More;
4 use FindBin;
5 use lib (($FindBin::Bin."/lib")=~/^(.*)$/);
6 use Module::Pluggable::Object;
7 use File::Spec::Functions qw(catfile);
8
9 my ($dodgy_file) = (catfile($FindBin::Bin,"lib", "EditorJunk", "Plugin", "#Bar.pm#")=~/^(.*)$/);
10 unless (-f $dodgy_file) {
11         plan skip_all => "Can't handle plugin names with octothorpes\n";
12 } else {
13         plan tests => 4;
14 }
15
16
17
18 my $foo;
19 ok($foo = EditorJunk->new());
20
21 my @plugins;
22 my @expected = qw(EditorJunk::Plugin::Bar EditorJunk::Plugin::Foo);
23 ok(@plugins = sort $foo->plugins);
24
25 is_deeply(\@plugins, \@expected, "is deeply");
26
27
28 my $mpo = Module::Pluggable::Object->new(
29     package             => 'EditorJunk',
30     filename            => __FILE__,
31     include_editor_junk => 1,
32 );
33
34 @expected = ('EditorJunk::Plugin::.#Bar', 'EditorJunk::Plugin::Bar', 'EditorJunk::Plugin::Foo');
35 @plugins = sort $mpo->plugins();
36 is_deeply(\@plugins, \@expected, "is deeply");
37
38
39
40 package EditorJunk;
41
42 use strict;
43 use Module::Pluggable;
44
45
46 sub new {
47     my $class = shift;
48     return bless {}, $class;
49
50 }
51 1;
52
53