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