line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Assert::Refute::T::Deep; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
89702
|
use 5.006; |
|
2
|
|
|
|
|
18
|
|
4
|
2
|
|
|
2
|
|
10
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
39
|
|
5
|
2
|
|
|
2
|
|
9
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
99
|
|
6
|
|
|
|
|
|
|
our $VERSION = '0.03'; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
=head1 NAME |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
Assert::Refute::T::Deep - Test::Deep plugin for Assert::Refute |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=head1 SYNOPSIS |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
See L for what a C block is for. |
15
|
|
|
|
|
|
|
In a nutshell, it's a set of L-like assertions |
16
|
|
|
|
|
|
|
that appends its results to a "report" object |
17
|
|
|
|
|
|
|
rather than standard output. |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
This module allows to use L with L: |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
use Assert::Refute; |
22
|
|
|
|
|
|
|
use Assert::Refute::T::Deep; |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
my $report = try_refute { |
25
|
|
|
|
|
|
|
cmp_deeply $my_data, $spec, "Data is as expected"; |
26
|
|
|
|
|
|
|
}; |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
if (!$report->is_passing) { |
29
|
|
|
|
|
|
|
warn $report->get_tap; |
30
|
|
|
|
|
|
|
}; |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=head1 EXPORT |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
Whatever is exported by L is also re-exported by this module. |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=cut |
38
|
|
|
|
|
|
|
|
39
|
2
|
|
|
2
|
|
441
|
use parent qw(Exporter); |
|
2
|
|
|
|
|
290
|
|
|
2
|
|
|
|
|
11
|
|
40
|
2
|
|
|
2
|
|
583
|
use Assert::Refute::Build; |
|
2
|
|
|
|
|
8526
|
|
|
2
|
|
|
|
|
125
|
|
41
|
2
|
|
|
2
|
|
882
|
use Test::Deep::NoTest qw(:all); |
|
2
|
|
|
|
|
19884
|
|
|
2
|
|
|
|
|
13
|
|
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
# Blindly reexport whatever Test::Deep has |
44
|
|
|
|
|
|
|
our @EXPORT = @Test::Deep::EXPORT; |
45
|
|
|
|
|
|
|
our @EXPORT_OK = @Test::Deep::EXPORT_OK; |
46
|
|
|
|
|
|
|
our %EXPORT_TAGS = %Test::Deep::EXPORT_TAGS; |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head2 cmp_deeply $got, $expected, "Message" |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
Compare data and report discrepancies if found. |
51
|
|
|
|
|
|
|
This only works if an L contract in being executed. |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=cut |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
# Remove the implementation imported from Test::Deep |
56
|
|
|
|
|
|
|
# to avoid redefine warnings. |
57
|
|
|
|
|
|
|
undef *cmp_deeply; |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
build_refute cmp_deeply => sub { |
60
|
2
|
|
|
2
|
|
4446
|
my ($ok, $stack) = cmp_details( @_ ); |
61
|
2
|
|
66
|
|
|
10754
|
return !$ok && deep_diag($stack); |
62
|
|
|
|
|
|
|
}, args => 2, export => 1; |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=head1 AUTHOR |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
Konstantin S. Uvarin, C<< >> |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=head1 BUGS |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
This module should be merged into either Assert::Refute or Test::Deep. |
71
|
|
|
|
|
|
|
Suggestions welcome. |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
Please report bugs via github or RT: |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=over |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=item * L |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=item * C |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=item * L |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=back |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=head1 SUPPORT |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
You can find documentation for this module with the C command. |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
perldoc Assert::Refute::T::Deep |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
You can also look for information at: |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=over 4 |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=item * Github: L |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=item * RT: CPAN's request tracker (report bugs here) |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
L |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=item * AnnoCPAN: Annotated CPAN documentation |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
L |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=item * CPAN Ratings |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
L |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
=item * Search CPAN |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
L |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=back |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=head1 ACKNOWLEDGEMENTS |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
Copyright 2018 Konstantin S. Uvarin. |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
124
|
|
|
|
|
|
|
under the terms of the the Artistic License (2.0). You may obtain a |
125
|
|
|
|
|
|
|
copy of the full license at: |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
L |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
Any use, modification, and distribution of the Standard or Modified |
130
|
|
|
|
|
|
|
Versions is governed by this Artistic License. By using, modifying or |
131
|
|
|
|
|
|
|
distributing the Package, you accept this license. Do not use, modify, |
132
|
|
|
|
|
|
|
or distribute the Package, if you do not accept this license. |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
If your Modified Version has been derived from a Modified Version made |
135
|
|
|
|
|
|
|
by someone other than you, you are nevertheless required to ensure that |
136
|
|
|
|
|
|
|
your Modified Version complies with the requirements of this license. |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
This license does not grant you the right to use any trademark, service |
139
|
|
|
|
|
|
|
mark, tradename, or logo of the Copyright Holder. |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
This license includes the non-exclusive, worldwide, free-of-charge |
142
|
|
|
|
|
|
|
patent license to make, have made, use, offer to sell, sell, import and |
143
|
|
|
|
|
|
|
otherwise transfer the Package with respect to any patent claims |
144
|
|
|
|
|
|
|
licensable by the Copyright Holder that are necessarily infringed by the |
145
|
|
|
|
|
|
|
Package. If you institute patent litigation (including a cross-claim or |
146
|
|
|
|
|
|
|
counterclaim) against any party alleging that the Package constitutes |
147
|
|
|
|
|
|
|
direct or contributory patent infringement, then this Artistic License |
148
|
|
|
|
|
|
|
to you shall terminate on the date that such litigation is filed. |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
Disclaimer of Warranty: THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER |
151
|
|
|
|
|
|
|
AND CONTRIBUTORS "AS IS' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. |
152
|
|
|
|
|
|
|
THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR |
153
|
|
|
|
|
|
|
PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY |
154
|
|
|
|
|
|
|
YOUR LOCAL LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR |
155
|
|
|
|
|
|
|
CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR |
156
|
|
|
|
|
|
|
CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE, |
157
|
|
|
|
|
|
|
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
=cut |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
1; # End of Assert::Refute::T::Deep |