| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Test::Stream::Plugin::Classic; |
|
2
|
2
|
|
|
2
|
|
330
|
use strict; |
|
|
2
|
|
|
|
|
2
|
|
|
|
2
|
|
|
|
|
44
|
|
|
3
|
2
|
|
|
2
|
|
6
|
use warnings; |
|
|
2
|
|
|
|
|
1
|
|
|
|
2
|
|
|
|
|
44
|
|
|
4
|
|
|
|
|
|
|
|
|
5
|
2
|
|
|
2
|
|
6
|
use Test::Stream::Exporter qw/import default_exports/; |
|
|
2
|
|
|
|
|
2
|
|
|
|
2
|
|
|
|
|
9
|
|
|
6
|
|
|
|
|
|
|
default_exports qw/is is_deeply isnt like unlike isa_ok/; |
|
7
|
2
|
|
|
2
|
|
8
|
no Test::Stream::Exporter; |
|
|
2
|
|
|
|
|
2
|
|
|
|
2
|
|
|
|
|
8
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
2
|
|
|
2
|
|
7
|
use Scalar::Util qw/blessed reftype/; |
|
|
2
|
|
|
|
|
2
|
|
|
|
2
|
|
|
|
|
96
|
|
|
10
|
|
|
|
|
|
|
|
|
11
|
2
|
|
|
2
|
|
646
|
use Test::Stream::Compare qw/-all/; |
|
|
2
|
|
|
|
|
3
|
|
|
|
2
|
|
|
|
|
6
|
|
|
12
|
2
|
|
|
2
|
|
9
|
use Test::Stream::Context qw/context/; |
|
|
2
|
|
|
|
|
2
|
|
|
|
2
|
|
|
|
|
11
|
|
|
13
|
2
|
|
|
2
|
|
8
|
use Test::Stream::Util qw/rtype render_ref protect/; |
|
|
2
|
|
|
|
|
2
|
|
|
|
2
|
|
|
|
|
6
|
|
|
14
|
|
|
|
|
|
|
|
|
15
|
2
|
|
|
2
|
|
710
|
use Test::Stream::Compare::String(); |
|
|
2
|
|
|
|
|
3
|
|
|
|
2
|
|
|
|
|
39
|
|
|
16
|
2
|
|
|
2
|
|
634
|
use Test::Stream::Compare::Pattern(); |
|
|
2
|
|
|
|
|
3
|
|
|
|
2
|
|
|
|
|
29
|
|
|
17
|
|
|
|
|
|
|
|
|
18
|
2
|
|
|
2
|
|
808
|
use Test::Stream::Plugin::Compare(); |
|
|
2
|
|
|
|
|
5
|
|
|
|
2
|
|
|
|
|
1241
|
|
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub is($$;$@) { |
|
21
|
7
|
|
|
7
|
1
|
27
|
my ($got, $exp, $name, @diag) = @_; |
|
22
|
7
|
|
|
|
|
13
|
my $ctx = context(); |
|
23
|
|
|
|
|
|
|
|
|
24
|
7
|
|
|
|
|
15
|
my @caller = caller; |
|
25
|
|
|
|
|
|
|
|
|
26
|
7
|
|
|
|
|
22
|
my $delta = compare($got, $exp, \&is_convert); |
|
27
|
|
|
|
|
|
|
|
|
28
|
7
|
100
|
|
|
|
12
|
if ($delta) { |
|
29
|
3
|
|
|
|
|
8
|
$ctx->ok(0, $name, [$delta->table, @diag]); |
|
30
|
|
|
|
|
|
|
} |
|
31
|
|
|
|
|
|
|
else { |
|
32
|
4
|
|
|
|
|
9
|
$ctx->ok(1, $name); |
|
33
|
|
|
|
|
|
|
} |
|
34
|
|
|
|
|
|
|
|
|
35
|
7
|
|
|
|
|
17
|
$ctx->release; |
|
36
|
7
|
|
|
|
|
35
|
return !$delta; |
|
37
|
|
|
|
|
|
|
} |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub isnt($$;$@) { |
|
40
|
4
|
|
|
4
|
1
|
16
|
my ($got, $exp, $name, @diag) = @_; |
|
41
|
4
|
|
|
|
|
9
|
my $ctx = context(); |
|
42
|
|
|
|
|
|
|
|
|
43
|
4
|
|
|
|
|
9
|
my @caller = caller; |
|
44
|
|
|
|
|
|
|
|
|
45
|
4
|
|
|
|
|
11
|
my $delta = compare($got, $exp, \&isnt_convert); |
|
46
|
|
|
|
|
|
|
|
|
47
|
4
|
100
|
|
|
|
9
|
if ($delta) { |
|
48
|
1
|
|
|
|
|
3
|
$ctx->ok(0, $name, [$delta->table, @diag]); |
|
49
|
|
|
|
|
|
|
} |
|
50
|
|
|
|
|
|
|
else { |
|
51
|
3
|
|
|
|
|
8
|
$ctx->ok(1, $name); |
|
52
|
|
|
|
|
|
|
} |
|
53
|
|
|
|
|
|
|
|
|
54
|
4
|
|
|
|
|
10
|
$ctx->release; |
|
55
|
4
|
|
|
|
|
12
|
return !$delta; |
|
56
|
|
|
|
|
|
|
} |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
sub is_convert { |
|
59
|
7
|
|
|
7
|
0
|
7
|
my ($thing) = @_; |
|
60
|
7
|
100
|
|
|
|
67
|
return Test::Stream::Compare::Undef->new() |
|
61
|
|
|
|
|
|
|
unless defined $thing; |
|
62
|
5
|
|
|
|
|
18
|
return Test::Stream::Compare::String->new(input => $thing); |
|
63
|
|
|
|
|
|
|
} |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
sub isnt_convert { |
|
66
|
4
|
|
|
4
|
0
|
5
|
my ($thing) = @_; |
|
67
|
4
|
50
|
|
|
|
6
|
return Test::Stream::Compare::Undef->new() |
|
68
|
|
|
|
|
|
|
unless defined $thing; |
|
69
|
4
|
|
|
|
|
13
|
my $str = Test::Stream::Compare::String->new(input => $thing, negate => 1); |
|
70
|
|
|
|
|
|
|
} |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
sub like($$;$@) { |
|
73
|
4
|
|
|
4
|
1
|
14
|
my ($got, $exp, $name, @diag) = @_; |
|
74
|
4
|
|
|
|
|
9
|
my $ctx = context(); |
|
75
|
|
|
|
|
|
|
|
|
76
|
4
|
|
|
|
|
11
|
my $delta = compare($got, $exp, \&like_convert); |
|
77
|
|
|
|
|
|
|
|
|
78
|
4
|
100
|
|
|
|
9
|
if ($delta) { |
|
79
|
1
|
|
|
|
|
4
|
$ctx->ok(0, $name, [$delta->table, @diag]); |
|
80
|
|
|
|
|
|
|
} |
|
81
|
|
|
|
|
|
|
else { |
|
82
|
3
|
|
|
|
|
7
|
$ctx->ok(1, $name); |
|
83
|
|
|
|
|
|
|
} |
|
84
|
|
|
|
|
|
|
|
|
85
|
4
|
|
|
|
|
253
|
$ctx->release; |
|
86
|
4
|
|
|
|
|
13
|
return !$delta; |
|
87
|
|
|
|
|
|
|
} |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
sub unlike($$;$@) { |
|
90
|
3
|
|
|
3
|
1
|
12
|
my ($got, $exp, $name, @diag) = @_; |
|
91
|
3
|
|
|
|
|
6
|
my $ctx = context(); |
|
92
|
|
|
|
|
|
|
|
|
93
|
3
|
|
|
|
|
9
|
my $delta = compare($got, $exp, \&unlike_convert); |
|
94
|
|
|
|
|
|
|
|
|
95
|
3
|
100
|
|
|
|
7
|
if ($delta) { |
|
96
|
1
|
|
|
|
|
4
|
$ctx->ok(0, $name, [$delta->table, @diag]); |
|
97
|
|
|
|
|
|
|
} |
|
98
|
|
|
|
|
|
|
else { |
|
99
|
2
|
|
|
|
|
5
|
$ctx->ok(1, $name); |
|
100
|
|
|
|
|
|
|
} |
|
101
|
|
|
|
|
|
|
|
|
102
|
3
|
|
|
|
|
9
|
$ctx->release; |
|
103
|
3
|
|
|
|
|
8
|
return !$delta; |
|
104
|
|
|
|
|
|
|
} |
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
sub like_convert { |
|
107
|
4
|
|
|
4
|
0
|
6
|
my ($thing) = @_; |
|
108
|
4
|
|
|
|
|
22
|
return Test::Stream::Compare::Pattern->new( |
|
109
|
|
|
|
|
|
|
pattern => $thing, |
|
110
|
|
|
|
|
|
|
stringify_got => 1, |
|
111
|
|
|
|
|
|
|
); |
|
112
|
|
|
|
|
|
|
} |
|
113
|
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
sub unlike_convert { |
|
115
|
3
|
|
|
3
|
0
|
4
|
my ($thing) = @_; |
|
116
|
3
|
|
|
|
|
8
|
return Test::Stream::Compare::Pattern->new( |
|
117
|
|
|
|
|
|
|
negate => 1, |
|
118
|
|
|
|
|
|
|
stringify_got => 1, |
|
119
|
|
|
|
|
|
|
pattern => $thing, |
|
120
|
|
|
|
|
|
|
); |
|
121
|
|
|
|
|
|
|
} |
|
122
|
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
sub is_deeply($$;$@) { |
|
124
|
3
|
|
|
3
|
1
|
3
|
my ($got, $exp, $name, @diag) = @_; |
|
125
|
3
|
|
|
|
|
7
|
my $ctx = context(); |
|
126
|
|
|
|
|
|
|
|
|
127
|
3
|
|
|
|
|
12
|
my @caller = caller; |
|
128
|
|
|
|
|
|
|
|
|
129
|
3
|
|
|
|
|
7
|
my $delta = compare($got, $exp, \&Test::Stream::Plugin::Compare::strict_convert); |
|
130
|
|
|
|
|
|
|
|
|
131
|
3
|
50
|
|
|
|
10
|
if ($delta) { |
|
132
|
0
|
|
|
|
|
0
|
$ctx->ok(0, $name, [$delta->table, @diag]); |
|
133
|
|
|
|
|
|
|
} |
|
134
|
|
|
|
|
|
|
else { |
|
135
|
3
|
|
|
|
|
8
|
$ctx->ok(1, $name); |
|
136
|
|
|
|
|
|
|
} |
|
137
|
|
|
|
|
|
|
|
|
138
|
3
|
|
|
|
|
8
|
$ctx->release; |
|
139
|
3
|
|
|
|
|
9
|
return !$delta; |
|
140
|
|
|
|
|
|
|
} |
|
141
|
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
sub isa_ok($;@) { |
|
143
|
2
|
|
|
2
|
1
|
5
|
my ($thing, @items) = @_; |
|
144
|
2
|
|
|
|
|
4
|
my $ctx = context(); |
|
145
|
|
|
|
|
|
|
|
|
146
|
2
|
|
|
|
|
4
|
my $file = $ctx->debug->file; |
|
147
|
2
|
|
|
|
|
8
|
my $line = $ctx->debug->line; |
|
148
|
|
|
|
|
|
|
|
|
149
|
2
|
|
|
|
|
5
|
my $name = render_ref($thing); |
|
150
|
2
|
|
50
|
|
|
6
|
my $type = reftype($thing) || ""; |
|
151
|
|
|
|
|
|
|
|
|
152
|
2
|
|
|
|
|
2
|
my @bad; |
|
153
|
|
|
|
|
|
|
|
|
154
|
2
|
|
|
|
|
3
|
for my $item (@items) { |
|
155
|
4
|
100
|
|
|
|
6
|
next if $item eq $type; |
|
156
|
3
|
|
|
|
|
4
|
my $bool; |
|
157
|
3
|
|
|
3
|
|
12
|
protect { eval qq/#line $line "$file"\n\$bool = \$thing->isa(\$item); 1/ }; |
|
|
3
|
|
|
|
|
102
|
|
|
158
|
3
|
100
|
|
|
|
10
|
next if $bool; |
|
159
|
|
|
|
|
|
|
|
|
160
|
2
|
|
|
|
|
5
|
push @bad => $item; |
|
161
|
|
|
|
|
|
|
} |
|
162
|
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
$ctx->ok( |
|
164
|
|
|
|
|
|
|
!@bad, |
|
165
|
|
|
|
|
|
|
@items == 1 ? "$name\->isa('$items[0]')" : "$name\->isa(...)", |
|
166
|
2
|
50
|
|
|
|
11
|
[map { "Failed: $name\->isa('$_')" } @bad], |
|
|
2
|
|
|
|
|
7
|
|
|
167
|
|
|
|
|
|
|
); |
|
168
|
|
|
|
|
|
|
|
|
169
|
2
|
|
|
|
|
6
|
$ctx->release; |
|
170
|
|
|
|
|
|
|
|
|
171
|
2
|
|
|
|
|
6
|
return !@bad; |
|
172
|
|
|
|
|
|
|
} |
|
173
|
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
1; |
|
175
|
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
__END__ |