1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
|
use strict;
use warnings;
use Test::More 0.96;
use Test::Fatal;
my $mod = 'Config::MVP::Slicer';
eval "require $mod" or die $@;
my $slicer = new_ok($mod);
is_deeply
[$slicer->plugin_info([Name => 'Class::Name' => {}])],
[Name => 'Class::Name' => {}],
'flatten array ref';
{ package # no_index
Config::MVP::Slicer::TestPlugin;
sub new { bless $_[1], $_[0]; }
sub plugin_name { $_[0]->{name}; }
}
my $plugin = Config::MVP::Slicer::TestPlugin->new({name => 'Hooey'});
is_deeply
[$slicer->plugin_info($plugin)],
[Hooey => 'Config::MVP::Slicer::TestPlugin' => {name => 'Hooey'}],
'instance with plugin_name';
like
exception { $slicer->plugin_info($slicer) },
qr/Don't know how to handle/,
'instance without plugin_name';
done_testing;
|