Move Module::Pluggable from ext/ to cpan/
[p5sagit/p5-mst-13.2.git] / cpan / Module-Pluggable / t / 21editor_junk.t
CommitLineData
183ac38d 1#!perl -w
2
3use Test::More;
4use FindBin;
5use lib (($FindBin::Bin."/lib")=~/^(.*)$/);
6use Module::Pluggable::Object;
7use File::Spec::Functions qw(catfile);
8
9my ($dodgy_file) = (catfile($FindBin::Bin,"lib", "EditorJunk", "Plugin", "#Bar.pm#")=~/^(.*)$/);
10unless (-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
18my $foo;
19ok($foo = EditorJunk->new());
20
21my @plugins;
22my @expected = qw(EditorJunk::Plugin::Bar EditorJunk::Plugin::Foo);
23ok(@plugins = sort $foo->plugins);
24
25is_deeply(\@plugins, \@expected, "is deeply");
26
27
28my $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();
36is_deeply(\@plugins, \@expected, "is deeply");
37
38
39
40package EditorJunk;
41
42use strict;
43use Module::Pluggable;
44
45
46sub new {
47 my $class = shift;
48 return bless {}, $class;
49
50}
511;
52
53