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

SOURCE

264       The source code repository for Test2-Suite can be found at
265       https://github.com/Test-More/Test2-Suite/.
266

MAINTAINERS

268       Chad Granum <exodist@cpan.org>
269

AUTHORS

271       Chad Granum <exodist@cpan.org>
272
274       Copyright 2018 Chad Granum <exodist@cpan.org>.
275
276       This program is free software; you can redistribute it and/or modify it
277       under the same terms as Perl itself.
278
279       See http://dev.perl.org/licenses/
280
281
282
283perl v5.28.1                      2018-12-04                      Test2::V0(3)
Impressum