-
Notifications
You must be signed in to change notification settings - Fork 10
/
03_extend.t
45 lines (36 loc) · 845 Bytes
/
03_extend.t
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
35
36
37
38
39
40
41
42
43
44
45
#!/usr/bin/env perl
use strict;
use Test::More tests => 6;
my ($base_start_called, $extended_start_called);
{
package Base;
use MooseX::POE;
sub START {
# Do this rather than embedd ::ok(1) here so ath get proper failing reports
::pass('Base Start');
$base_start_called = 1;
};
sub on_foo {
::pass('on_foo');
$_[KERNEL]->yield('bar');
}
}
{
package Extended;
use MooseX::POE;
extends 'Base';
sub START {
::pass('Extended after Start');
$extended_start_called = 1;
$_[KERNEL]->yield('foo');
};
sub on_bar {
::pass('on_bar');
}
}
my $foo = Extended->new();
POE::Kernel->run();
# If the test count for this test is wrong, on_foo probably isn't getting set
# as an event properly
ok($base_start_called, "Base START called");
ok($extended_start_called,"Extended START called");