1Test2::V0(3)          User Contributed Perl Documentation         Test2::V0(3)
2
3
4

NAME

6       Test2::V0 - 0Th edition of the Test2 recommended bundle.
7

DESCRIPTION

9       This is the big-daddy bundle. This bundle includes nearly every tool,
10       and several plugins, that the Test2 author uses. This bundle is used
11       extensively to test Test2::Suite itself.
12

NAMING, USING, DEPENDING

14       This bundle should not change in a severely incompatible way. Some
15       minor breaking changes, specially bugfixes, may be allowed. If breaking
16       changes are needed then a new "Test2::V#" module should be released
17       instead.
18
19       As new "V#" modules are released old ones may be moved to different
20       cpan distributions. You should always use a specific bundle version and
21       list that version in your distributions testing requirements. You
22       should never simply list Test2::Suite as your modules dep, instead list
23       the specific bundle, or tools and plugins you use directly in your
24       metadata.
25

SYNOPSIS

27           use Test2::V0;
28
29           ok(1, "pass");
30
31           ...
32
33           done_testing;
34

RESOLVING CONFLICTS WITH MOOSE

36           use Test2::V0 '!meta';
37
38       Moose and Test2::V0 both export very different "meta()" subs. Adding
39       '!meta' to the import args will prevent the sub from being imported.
40       This bundle also exports the sub under the name "meta_check()" so you
41       can use that spelling as an alternative.
42
43   TAGS
44       :DEFAULT
45           The following are both identical:
46
47               use Test2::V0;
48
49               use Test2::V0 ':DEFAULT';
50
51   RENAMING ON IMPORT
52           use Test2::V0 ':DEFAULT', '!ok', ok => {-as => 'my_ok'};
53
54       This bundle uses Importer for exporting, as such you can use any
55       arguments it accepts.
56
57       Explanation:
58
59       '!ok'
60           Do not export "ok()"
61
62       ok => {-as => 'my_ok'}
63           Actually, go ahead and import "ok()" but under the name "my_ok()".
64
65       If you did not add the '!ok' argument then you would have both "ok()"
66       and "my_ok()"
67

PRAGMAS

69       All of these can be disabled via individual import arguments, or by the
70       "-no_pragmas" argument.
71
72           use Test2::V0 -no_pragmas => 1;
73
74   STRICT
75       strict is turned on for you. You can disable this with the "-no_strict"
76       or "-no_pragmas" import arguments:
77
78           use Test2::V0 -no_strict => 1;
79
80   WARNINGS
81       warnings are turned on for you. You can disable this with the
82       "-no_warnings" or "-no_pragmas" import arguments:
83
84           use Test2::V0 -no_warnings => 1;
85
86   UTF8
87       This is actually done via the Test2::Plugin::UTF8 plugin, see the
88       "PLUGINS" section for details.
89
90       Note: "-no_pragmas => 1" will turn off the entire plugin.
91

PLUGINS

93   SRAND
94       See Test2::Plugin::SRand.
95
96       This will set the random seed to today's date. You can provide an
97       alternate seed with the "-srand" import option:
98
99           use Test2::V0 -srand => 1234;
100
101   UTF8
102       See Test2::Plugin::UTF8.
103
104       This will set the file, and all output handles (including formatter
105       handles), to utf8. This will turn on the utf8 pragma for the current
106       scope.
107
108       This can be disabled using the "-no_utf8 => 1" or "-no_pragmas => 1"
109       import arguments.
110
111           use Test2::V0 -no_utf8 => 1;
112
113   EXIT SUMMARY
114       See Test2::Plugin::ExitSummary.
115
116       This plugin has no configuration.
117

API FUNCTIONS

119       See Test2::API for these
120
121       $ctx = context()
122       $events = intercept { ... }
123

TOOLS

125   TARGET
126       See Test2::Tools::Target.
127
128       You can specify a target class with the "-target" import argument. If
129       you do not provide a target then $CLASS and "CLASS()" will not be
130       imported.
131
132           use Test2::V0 -target => 'My::Class';
133
134           print $CLASS;  # My::Class
135           print CLASS(); # My::Class
136
137       Or you can specify names:
138
139           use Test2::V0 -target => { pkg => 'Some::Package' };
140
141           pkg()->xxx; # Call 'xxx' on Some::Package
142           $pkg->xxx;  # Same
143
144       $CLASS
145           Package variable that contains the target class name.
146
147       $class = CLASS()
148           Constant function that returns the target class name.
149
150   DEFER
151       See Test2::Tools::Defer.
152
153       def $func => @args;
154       do_def()
155
156   BASIC
157       See Test2::Tools::Basic.
158
159       ok($bool, $name)
160       pass($name)
161       fail($name)
162       diag($message)
163       note($message)
164       $todo = todo($reason)
165       todo $reason => sub { ... }
166       skip($reason, $count)
167       plan($count)
168       skip_all($reason)
169       done_testing()
170       bail_out($reason)
171
172   COMPARE
173       See Test2::Tools::Compare.
174
175       is($got, $want, $name)
176       isnt($got, $do_not_want, $name)
177       like($got, qr/match/, $name)
178       unlike($got, qr/mismatch/, $name)
179       $check = match(qr/pattern/)
180       $check = mismatch(qr/pattern/)
181       $check = validator(sub { return $bool })
182       $check = hash { ... }
183       $check = array { ... }
184       $check = bag { ... }
185       $check = object { ... }
186       $check = meta { ... }
187       $check = number($num)
188       $check = string($str)
189       $check = in_set(@things)
190       $check = not_in_set(@things)
191       $check = check_set(@things)
192       $check = item($thing)
193       $check = item($idx => $thing)
194       $check = field($name => $val)
195       $check = call($method => $expect)
196       $check = call_list($method => $expect)
197       $check = call_hash($method => $expect)
198       $check = prop($name => $expect)
199       $check = check($thing)
200       $check = T()
201       $check = F()
202       $check = D()
203       $check = DF()
204       $check = DNE()
205       $check = FDNE()
206       $check = exact_ref($ref)
207       end()
208       etc()
209       filter_items { grep { ... } @_ }
210       $check = event $type => ...
211       @checks = fail_events $type => ...
212
213   CLASSIC COMPARE
214       See Test2::Tools::ClassicCompare.
215
216       cmp_ok($got, $op, $want, $name)
217
218   SUBTEST
219       See Test2::Tools::Subtest.
220
221       subtest $name => sub { ... };
222           (Note: This is called "subtest_buffered()" in the Tools module.)
223
224   CLASS
225       See Test2::Tools::Class.
226
227       can_ok($thing, @methods)
228       isa_ok($thing, @classes)
229       DOES_ok($thing, @roles)
230
231   ENCODING
232       See Test2::Tools::Encoding.
233
234       set_encoding($encoding)
235
236   EXPORTS
237       See Test2::Tools::Exports.
238
239       imported_ok('function', '$scalar', ...)
240       not_imported_ok('function', '$scalar', ...)
241
242   REF
243       See Test2::Tools::Ref.
244
245       ref_ok($ref, $type)
246       ref_is($got, $want)
247       ref_is_not($got, $do_not_want)
248
249   MOCK
250       See Test2::Tools::Mock.
251
252       $control = mock ...
253       $bool = mocked($thing)
254
255   EXCEPTION
256       See Test2::Tools::Exception.
257
258       $exception = dies { ... }
259       $bool = lives { ... }
260       $bool = try_ok { ... }
261
262   WARNINGS
263       See Test2::Tools::Warnings.
264
265       $count = warns { ... }
266       $warning = warning { ... }
267       $warnings_ref = warnings { ... }
268       $bool = no_warnings { ... }
269

SOURCE

271       The source code repository for Test2-Suite can be found at
272       https://github.com/Test-More/Test2-Suite/.
273

MAINTAINERS

275       Chad Granum <exodist@cpan.org>
276

AUTHORS

278       Chad Granum <exodist@cpan.org>
279
281       Copyright 2018 Chad Granum <exodist@cpan.org>.
282
283       This program is free software; you can redistribute it and/or modify it
284       under the same terms as Perl itself.
285
286       See http://dev.perl.org/licenses/
287
288
289
290perl v5.30.1                      2020-01-31                      Test2::V0(3)
Impressum