1Test2::Bundle::ExtendedU(s3e)r Contributed Perl DocumentaTteisotn2::Bundle::Extended(3)
2
3
4

NAME

6       Test2::Bundle::Extended - Old name for Test2::V0
7

*** DEPRECATED ***

9       This bundle has been renamed to Test2::V0, in which the ':v1' tag has
10       been removed as unnecessary.
11

DESCRIPTION

13       This is the big-daddy bundle. This bundle includes nearly every tool,
14       and several plugins, that the Test2 author uses. This bundle is used
15       extensively to test Test2::Suite itself.
16

SYNOPSIS

18           use Test2::Bundle::Extended ':v1';
19
20           ok(1, "pass");
21
22           ...
23
24           done_testing;
25

RESOLVING CONFLICTS WITH MOOSE

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

PRAGMAS

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

PLUGINS

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

API FUNCTIONS

116       See Test2::API for these
117
118       $ctx = context()
119       $events = intercept { ... }
120

TOOLS

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

SOURCE

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

MAINTAINERS

276       Chad Granum <exodist@cpan.org>
277

AUTHORS

279       Chad Granum <exodist@cpan.org>
280
282       Copyright 2018 Chad Granum <exodist@cpan.org>.
283
284       This program is free software; you can redistribute it and/or modify it
285       under the same terms as Perl itself.
286
287       See http://dev.perl.org/licenses/
288
289
290
291perl v5.34.0                      2022-03-08        Test2::Bundle::Extended(3)
Impressum