| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Test::Class::Moose::Role; |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# ABSTRACT: Test::Class::Moose for roles |
|
4
|
|
|
|
|
|
|
|
|
5
|
2
|
|
|
2
|
|
13302
|
use strict; |
|
|
2
|
|
|
|
|
17
|
|
|
|
2
|
|
|
|
|
75
|
|
|
6
|
2
|
|
|
2
|
|
12
|
use warnings; |
|
|
2
|
|
|
|
|
5
|
|
|
|
2
|
|
|
|
|
57
|
|
|
7
|
2
|
|
|
2
|
|
12
|
use namespace::autoclean; |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
17
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
2
|
|
|
2
|
|
212
|
use 5.010000; |
|
|
2
|
|
|
|
|
7
|
|
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our $VERSION = '0.99'; |
|
12
|
|
|
|
|
|
|
|
|
13
|
2
|
|
|
2
|
|
17
|
use Carp; |
|
|
2
|
|
|
|
|
6
|
|
|
|
2
|
|
|
|
|
156
|
|
|
14
|
|
|
|
|
|
|
|
|
15
|
2
|
|
|
2
|
|
18
|
use Sub::Attribute; |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
112
|
|
|
16
|
2
|
|
|
2
|
|
14
|
use Import::Into; |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
66
|
|
|
17
|
2
|
|
|
2
|
|
14
|
use Test::Class::Moose::AttributeRegistry; |
|
|
2
|
|
|
|
|
5
|
|
|
|
2
|
|
|
|
|
183
|
|
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
BEGIN { |
|
20
|
2
|
|
|
2
|
|
15
|
require Test::Class::Moose; |
|
21
|
|
|
|
|
|
|
## no critic (BuiltinFunctions::ProhibitStringyEval, ErrorHandling::RequireCheckingReturnValueOfEval) |
|
22
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
|
|
|
0
|
|
|
|
|
0
|
|
|
|
0
|
|
|
|
|
0
|
|
|
|
0
|
|
|
|
|
0
|
|
|
|
0
|
|
|
|
|
0
|
|
|
|
0
|
|
|
|
|
0
|
|
|
24
|
2
|
50
|
|
|
|
490
|
croak($@) if $@; |
|
25
|
|
|
|
|
|
|
} |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub import { |
|
28
|
2
|
|
|
2
|
|
17
|
shift; |
|
29
|
2
|
|
|
|
|
7
|
my %args = @_; |
|
30
|
|
|
|
|
|
|
|
|
31
|
2
|
|
|
|
|
7
|
my $caller = caller; |
|
32
|
|
|
|
|
|
|
|
|
33
|
2
|
|
|
|
|
24
|
my @imports = qw( |
|
34
|
|
|
|
|
|
|
Moose::Role |
|
35
|
|
|
|
|
|
|
Sub::Attribute |
|
36
|
|
|
|
|
|
|
strict |
|
37
|
|
|
|
|
|
|
warnings |
|
38
|
|
|
|
|
|
|
); |
|
39
|
|
|
|
|
|
|
|
|
40
|
2
|
100
|
|
|
|
9
|
unless ( $args{bare} ) { |
|
41
|
1
|
|
|
|
|
6
|
require Test::Most; |
|
42
|
1
|
|
|
|
|
3
|
push @imports, 'Test::Most'; |
|
43
|
|
|
|
|
|
|
} |
|
44
|
|
|
|
|
|
|
|
|
45
|
2
|
|
|
|
|
30
|
$_->import::into($caller) for @imports; |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
## no critic (TestingAndDebugging::ProhibitNoStrict) |
|
48
|
2
|
|
|
2
|
|
17
|
no strict 'refs'; |
|
|
2
|
|
|
|
|
5
|
|
|
|
2
|
|
|
|
|
309
|
|
|
49
|
1
|
|
|
|
|
3131
|
*{"$caller\::Tags"} = \&Tags; |
|
|
1
|
|
|
|
|
7
|
|
|
50
|
1
|
|
|
|
|
4
|
*{"$caller\::Test"} = \&Test; |
|
|
1
|
|
|
|
|
5
|
|
|
51
|
1
|
|
|
|
|
3
|
*{"$caller\::Tests"} = \&Tests; |
|
|
1
|
|
|
|
|
100
|
|
|
52
|
|
|
|
|
|
|
} |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
1; |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
__END__ |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=pod |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=encoding UTF-8 |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=head1 NAME |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
Test::Class::Moose::Role - Test::Class::Moose for roles |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=head1 VERSION |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
version 0.99 |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
If you need the functionality of L<Test::Class::Moose> to be available inside |
|
73
|
|
|
|
|
|
|
of a role, this is the module to do that. This is how you can declare a TCM |
|
74
|
|
|
|
|
|
|
role: |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
package TestsFor::Basic::Role; |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
use Test::Class::Moose::Role; |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
sub test_in_a_role { |
|
81
|
|
|
|
|
|
|
my $test = shift; |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
pass "This is picked up from role"; |
|
84
|
|
|
|
|
|
|
} |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
sub in_a_role_with_tags : Tags(first){ |
|
88
|
|
|
|
|
|
|
fail "We should never see this test"; |
|
89
|
|
|
|
|
|
|
} |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
sub test_in_a_role_with_tags : Tags(second){ |
|
93
|
|
|
|
|
|
|
pass "We should see this test"; |
|
94
|
|
|
|
|
|
|
} |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
1; |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
And to consume it: |
|
99
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
package TestsFor::Basic::WithRole; |
|
101
|
|
|
|
|
|
|
use Test::Class::Moose; |
|
102
|
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
with qw/TestsFor::Basic::Role/; |
|
104
|
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
sub test_in_withrole { |
|
106
|
|
|
|
|
|
|
pass "Got here"; |
|
107
|
|
|
|
|
|
|
} |
|
108
|
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
1; |
|
110
|
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
Note that this cannot be consumed into classes and magically make them into |
|
112
|
|
|
|
|
|
|
test classes. You must still (at the present time) inherit from |
|
113
|
|
|
|
|
|
|
C<Test::Class::Moose> to create a test suite. |
|
114
|
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=head2 Skipping Test::Most |
|
116
|
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
By default, when you C<use Test::Class::Moose::Role> in your own test class, it |
|
118
|
|
|
|
|
|
|
exports all the subs from L<Test::Most> into your class. If you'd prefer to |
|
119
|
|
|
|
|
|
|
import a different set of test tools, you can pass C<< bare => 1 >> when using |
|
120
|
|
|
|
|
|
|
C<Test::Class::Moose::Role>: |
|
121
|
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
use Test::Class::Moose::Role bare => 1; |
|
123
|
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
When you pass this, C<Test::Class::Moose::Role> will not export L<Test::Most>'s subs |
|
125
|
|
|
|
|
|
|
into your class. You will have to explicitly import something like |
|
126
|
|
|
|
|
|
|
L<Test::More> or L<Test2::Tools::Compare> in order to actually perform tests. |
|
127
|
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
=for Pod::Coverage Tags Test Tests |
|
129
|
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
=head1 SUPPORT |
|
131
|
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
Bugs may be submitted at L<https://github.com/houseabsolute/test-class-moose/issues>. |
|
133
|
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
I am also usually active on IRC as 'autarch' on C<irc://irc.perl.org>. |
|
135
|
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
=head1 SOURCE |
|
137
|
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
The source code repository for Test-Class-Moose can be found at L<https://github.com/houseabsolute/test-class-moose>. |
|
139
|
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
=head1 AUTHORS |
|
141
|
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
=over 4 |
|
143
|
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
=item * |
|
145
|
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
Curtis "Ovid" Poe <ovid@cpan.org> |
|
147
|
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
=item * |
|
149
|
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
Dave Rolsky <autarch@urth.org> |
|
151
|
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
=back |
|
153
|
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
155
|
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
This software is copyright (c) 2012 - 2021 by Curtis "Ovid" Poe. |
|
157
|
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
|
159
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
|
160
|
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
The full text of the license can be found in the |
|
162
|
|
|
|
|
|
|
F<LICENSE> file included with this distribution. |
|
163
|
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
=cut |