line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test::Ika; |
2
|
13
|
|
|
13
|
|
318935
|
use strict; |
|
13
|
|
|
|
|
34
|
|
|
13
|
|
|
|
|
512
|
|
3
|
13
|
|
|
13
|
|
64
|
use warnings; |
|
13
|
|
|
|
|
53
|
|
|
13
|
|
|
|
|
314
|
|
4
|
13
|
|
|
13
|
|
309
|
use 5.010001; |
|
13
|
|
|
|
|
42
|
|
|
13
|
|
|
|
|
735
|
|
5
|
|
|
|
|
|
|
our $VERSION = '0.08'; |
6
|
|
|
|
|
|
|
|
7
|
13
|
|
|
13
|
|
13304
|
use Module::Load; |
|
13
|
|
|
|
|
13857
|
|
|
13
|
|
|
|
|
72
|
|
8
|
13
|
|
|
13
|
|
11535
|
use Test::Name::FromLine; |
|
13
|
|
|
|
|
234250
|
|
|
13
|
|
|
|
|
424
|
|
9
|
|
|
|
|
|
|
|
10
|
13
|
|
|
13
|
|
7286
|
use Test::Ika::ExampleGroup; |
|
13
|
|
|
|
|
37
|
|
|
13
|
|
|
|
|
378
|
|
11
|
13
|
|
|
13
|
|
6947
|
use Test::Ika::Example; |
|
13
|
|
|
|
|
34
|
|
|
13
|
|
|
|
|
389
|
|
12
|
|
|
|
|
|
|
|
13
|
13
|
|
|
13
|
|
11110
|
use parent qw/Exporter/; |
|
13
|
|
|
|
|
3889
|
|
|
13
|
|
|
|
|
69
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
our @EXPORT = (qw( |
16
|
|
|
|
|
|
|
describe context it |
17
|
|
|
|
|
|
|
xdescribe xcontext xit |
18
|
|
|
|
|
|
|
when |
19
|
|
|
|
|
|
|
before_suite after_suite |
20
|
|
|
|
|
|
|
before_all after_all before_each after_each |
21
|
|
|
|
|
|
|
runtests |
22
|
|
|
|
|
|
|
)); |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
our $FINISHED; |
26
|
|
|
|
|
|
|
our $ROOT = our $CURRENT = Test::Ika::ExampleGroup->new(name => 'root', root => 1); |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
our $REPORTER; |
29
|
|
|
|
|
|
|
{ |
30
|
|
|
|
|
|
|
my $module = $ENV{TEST_MAX_REPORTER}; |
31
|
|
|
|
|
|
|
unless ($module) { |
32
|
|
|
|
|
|
|
$module = $ENV{HARNESS_ACTIVE} || $^O eq 'MSWin32' ? 'TAP' : 'Spec'; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
__PACKAGE__->set_reporter($module); |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
1
|
|
|
1
|
1
|
14
|
sub reporter { $REPORTER } |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub build_reporter_option { |
40
|
14
|
|
|
14
|
0
|
32
|
my $class = shift; |
41
|
|
|
|
|
|
|
return +{ |
42
|
14
|
|
|
|
|
144
|
color => ! $ENV{TEST_IKA_NOCOLOR}, |
43
|
|
|
|
|
|
|
}; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub set_reporter { |
47
|
14
|
|
|
14
|
1
|
36
|
my ($class, $module) = @_; |
48
|
14
|
|
|
|
|
45
|
$REPORTER = $class->load_reporter($module); |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub load_reporter { |
52
|
14
|
|
|
14
|
0
|
29
|
my ($class, $module) = @_; |
53
|
14
|
50
|
|
|
|
80
|
$module = ($module =~ s/^\+// ? $module : "Test::Ika::Reporter::$module"); |
54
|
14
|
|
|
|
|
65
|
Module::Load::load($module); |
55
|
|
|
|
|
|
|
|
56
|
14
|
|
|
|
|
420
|
return $module->new(__PACKAGE__->build_reporter_option); |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
sub describe { |
60
|
0
|
50
|
|
0
|
1
|
0
|
my $code = ref $_[-1] eq 'CODE' ? pop : sub {}; |
|
25
|
|
|
25
|
|
316
|
|
61
|
25
|
|
|
|
|
57
|
my ($name, $cond) = @_; |
62
|
|
|
|
|
|
|
|
63
|
25
|
|
|
|
|
40
|
my $current = $CURRENT; |
64
|
25
|
|
|
|
|
171
|
my $context = Test::Ika::ExampleGroup->new( |
65
|
|
|
|
|
|
|
name => $name, |
66
|
|
|
|
|
|
|
parent => $current, |
67
|
|
|
|
|
|
|
cond => $cond, |
68
|
|
|
|
|
|
|
); |
69
|
|
|
|
|
|
|
{ |
70
|
25
|
|
|
|
|
48
|
local $CURRENT = $context; |
|
25
|
|
|
|
|
39
|
|
71
|
25
|
|
|
|
|
71
|
$code->(); |
72
|
|
|
|
|
|
|
} |
73
|
25
|
|
|
|
|
93
|
$current->add_example_group($context); |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
*context = *describe; |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
sub when (&) { |
78
|
5
|
|
|
5
|
1
|
76
|
return $_[0]; |
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
sub it { |
82
|
35
|
100
|
|
35
|
1
|
271
|
my $code = ref $_[-1] eq 'CODE' ? pop : undef; |
83
|
35
|
|
|
|
|
61
|
my ($name, $cond) = @_; |
84
|
35
|
|
|
|
|
202
|
my $it = Test::Ika::Example->new(name => $name, code => $code, cond => $cond); |
85
|
35
|
|
|
|
|
123
|
$CURRENT->add_example($it); |
86
|
|
|
|
|
|
|
} |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
sub xit { |
89
|
9
|
100
|
|
9
|
1
|
77
|
my $code = ref $_[-1] eq 'CODE' ? pop : undef; |
90
|
9
|
|
|
|
|
17
|
my ($name, $cond) = @_; |
91
|
9
|
|
|
|
|
49
|
my $it = Test::Ika::Example->new(name => $name, code => $code, cond => $cond, skip => 1); |
92
|
9
|
|
|
|
|
37
|
$CURRENT->add_example($it); |
93
|
|
|
|
|
|
|
} |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
sub xdescribe { |
96
|
2
|
|
|
2
|
0
|
29
|
my $caller = caller(0); |
97
|
|
|
|
|
|
|
|
98
|
13
|
|
|
13
|
|
10432
|
no strict 'refs'; |
|
13
|
|
|
|
|
33
|
|
|
13
|
|
|
|
|
417
|
|
99
|
13
|
|
|
13
|
|
63
|
no warnings 'redefine'; |
|
13
|
|
|
|
|
18
|
|
|
13
|
|
|
|
|
6405
|
|
100
|
|
|
|
|
|
|
|
101
|
2
|
|
|
|
|
6
|
local *{"${caller}::it"} = \&xit; |
|
2
|
|
|
|
|
13
|
|
102
|
|
|
|
|
|
|
|
103
|
2
|
|
|
8
|
|
9
|
my $noop = sub {}; |
|
8
|
|
|
|
|
54
|
|
104
|
2
|
|
|
|
|
5
|
local *{"${caller}::before_all"} = $noop; |
|
2
|
|
|
|
|
10
|
|
105
|
2
|
|
|
|
|
3
|
local *{"${caller}::after_all"} = $noop; |
|
2
|
|
|
|
|
10
|
|
106
|
2
|
|
|
|
|
5
|
local *{"${caller}::before_each"} = $noop; |
|
2
|
|
|
|
|
9
|
|
107
|
2
|
|
|
|
|
3
|
local *{"${caller}::after_each"} = $noop; |
|
2
|
|
|
|
|
8
|
|
108
|
|
|
|
|
|
|
|
109
|
2
|
|
|
|
|
9
|
describe(@_); |
110
|
|
|
|
|
|
|
} |
111
|
|
|
|
|
|
|
*xcontext = \&xdescribe; |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
sub before_suite(&) { |
114
|
3
|
|
|
3
|
1
|
34
|
my $code = shift; |
115
|
3
|
|
|
|
|
20
|
$ROOT->add_trigger(before_all => $code); |
116
|
|
|
|
|
|
|
} |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
sub after_suite(&) { |
119
|
3
|
|
|
3
|
1
|
24
|
my $code = shift; |
120
|
3
|
|
|
|
|
19
|
$ROOT->add_trigger(after_all => $code); |
121
|
|
|
|
|
|
|
} |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
sub before_all(&) { |
124
|
11
|
|
|
11
|
1
|
77
|
my $code = shift; |
125
|
11
|
|
|
|
|
46
|
$CURRENT->add_trigger(before_all => $code); |
126
|
|
|
|
|
|
|
} |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
sub after_all(&) { |
129
|
11
|
|
|
11
|
1
|
66
|
my $code = shift; |
130
|
11
|
|
|
|
|
45
|
$CURRENT->add_trigger(after_all => $code); |
131
|
|
|
|
|
|
|
} |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
sub before_each(&) { |
134
|
9
|
|
|
9
|
1
|
66
|
my $code = shift; |
135
|
9
|
|
|
|
|
34
|
$CURRENT->add_trigger(before_each => $code); |
136
|
|
|
|
|
|
|
} |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
sub after_each(&) { |
139
|
9
|
|
|
9
|
1
|
71
|
my $code = shift; |
140
|
9
|
|
|
|
|
36
|
$CURRENT->add_trigger(after_each => $code); |
141
|
|
|
|
|
|
|
} |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
sub runtests { |
144
|
13
|
|
|
13
|
1
|
106
|
$ROOT->run(); |
145
|
|
|
|
|
|
|
|
146
|
13
|
|
|
|
|
46
|
$FINISHED++; |
147
|
13
|
|
|
|
|
63
|
$REPORTER->finalize(); |
148
|
|
|
|
|
|
|
} |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
END { |
151
|
13
|
100
|
|
13
|
|
16987
|
unless ($FINISHED) { |
152
|
1
|
|
|
|
|
4
|
runtests(); |
153
|
|
|
|
|
|
|
} |
154
|
|
|
|
|
|
|
} |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
1; |
157
|
|
|
|
|
|
|
__END__ |