line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package POE::Test::Sequence; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
402
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
37
|
|
4
|
1
|
|
|
1
|
|
3
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
29
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
3
|
use Carp qw(croak); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
45
|
|
7
|
1
|
|
|
1
|
|
4
|
use POE; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
4
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub new { |
10
|
1
|
|
|
1
|
1
|
275
|
my ($class, %args) = @_; |
11
|
|
|
|
|
|
|
|
12
|
1
|
|
|
|
|
3
|
my $sequence = delete $args{sequence}; |
13
|
1
|
50
|
|
|
|
4
|
croak "sequence required" unless defined $sequence; |
14
|
|
|
|
|
|
|
|
15
|
1
|
|
|
|
|
7
|
return bless { |
16
|
|
|
|
|
|
|
sequence => $sequence, |
17
|
|
|
|
|
|
|
test_count => scalar( @$sequence ), |
18
|
|
|
|
|
|
|
}, $class; |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub next { |
22
|
15
|
|
|
15
|
1
|
236
|
my ($self, $event, $parameter) = @_; |
23
|
|
|
|
|
|
|
|
24
|
15
|
|
|
|
|
15
|
my $expected_result = shift @{ $self->{sequence} }; |
|
15
|
|
|
|
|
196
|
|
25
|
15
|
50
|
|
|
|
31
|
unless (defined $expected_result) { |
26
|
0
|
|
|
|
|
0
|
Test::More::fail( |
27
|
|
|
|
|
|
|
"Got an unexpected result ($event, $parameter). Time to bye." |
28
|
|
|
|
|
|
|
); |
29
|
0
|
|
|
|
|
0
|
exit; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
15
|
|
|
|
|
25
|
my $next_action = pop @$expected_result; |
33
|
|
|
|
|
|
|
|
34
|
15
|
|
|
|
|
68
|
Test::More::note "Testing (@$expected_result)"; |
35
|
|
|
|
|
|
|
|
36
|
15
|
|
|
|
|
2802
|
Test::More::is_deeply( [ $event, $parameter ], $expected_result ); |
37
|
|
|
|
|
|
|
|
38
|
15
|
|
100
|
4
|
|
8389
|
return $next_action || sub { undef }; |
|
4
|
|
|
|
|
23
|
|
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub test_count { |
42
|
1
|
|
|
1
|
1
|
13
|
return $_[0]{test_count}; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub create_generic_session { |
46
|
0
|
|
|
0
|
1
|
|
my ($self) = @_; |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
POE::Session->create( |
49
|
|
|
|
|
|
|
inline_states => { |
50
|
0
|
|
|
0
|
|
|
_start => sub { goto $self->next( $_[STATE], 0 ) }, |
51
|
0
|
|
|
0
|
|
|
_default => sub { goto $self->next( $_[ARG0], 0 ) }, |
52
|
|
|
|
|
|
|
} |
53
|
0
|
|
|
|
|
|
); |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
1; |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
__END__ |