Debian Codegraph @

t/04_plugins/02_connector/01_load.t

raw
1 use strict;
2 use warnings FATAL => 'all';
3 use Test::More tests => 3;
4 use POE;
5 use POE::Component::IRC;
6 use POE::Component::IRC::Plugin::Connector;
7
8 my $bot = POE::Component::IRC->spawn( plugin_debug => 1 );
9
10 POE::Session->create(
11 package_states => [
12 main => [ qw(_start irc_plugin_add irc_plugin_del) ],
13 ],
14 );
15
16 $poe_kernel->run();
17
18 sub _start {
19 $bot->yield(register => 'all');
20
21 my $plugin = POE::Component::IRC::Plugin::Connector->new();
22 isa_ok($plugin, 'POE::Component::IRC::Plugin::Connector');
23
24 if (!$bot->plugin_add('TestPlugin', $plugin )) {
25 fail('plugin_add failed');
26 $bot->yield('shutdown');
27 }
28 }
29
30 sub irc_plugin_add {
31 my ($name, $plugin) = @_[ARG0, ARG1];
32 return if $name ne 'TestPlugin';
33
34 isa_ok($plugin, 'POE::Component::IRC::Plugin::Connector');
35
36 if (!$bot->plugin_del('TestPlugin') ) {
37 fail('plugin_del failed');
38 $bot->yield('shutdown');
39 }
40 }
41
42 sub irc_plugin_del {
43 my ($name, $plugin) = @_[ARG0, ARG1];
44 return if $name ne 'TestPlugin';
45
46 isa_ok($plugin, 'POE::Component::IRC::Plugin::Connector');
47 $bot->yield('shutdown');
48 }