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 = DNE()
203       $check = FDNE()
204       $check = exact_ref($ref)
205       end()
206       etc()
207       filter_items { grep { ... } @_ }
208       $check = event $type => ...
209       @checks = fail_events $type => ...
210
211   CLASSIC COMPARE
212       See Test2::Tools::ClassicCompare.
213
214       cmp_ok($got, $op, $want, $name)
215
216   SUBTEST
217       See Test2::Tools::Subtest.
218
219       subtest $name => sub { ... }
220           (Note: This is called "subtest_buffered()" in the Tools module.)
221
222   CLASS
223       See Test2::Tools::Class.
224
225       can_ok($thing, @methods)
226       isa_ok($thing, @classes)
227       DOES_ok($thing, @roles)
228
229   ENCODING
230       See Test2::Tools::Encoding.
231
232       set_encoding($encoding)
233
234   EXPORTS
235       See Test2::Tools::Exports.
236
237       imported_ok('function', '$scalar', ...)
238       not_imported_ok('function', '$scalar', ...)
239
240   REF
241       See Test2::Tools::Ref.
242
243       ref_ok($ref, $type)
244       ref_is($got, $want)
245       ref_is_not($got, $do_not_want)
246
247   MOCK
248       See Test2::Tools::Mock.
249
250       $control = mock ...
251       $bool = mocked($thing)
252
253   EXCEPTION
254       See Test2::Tools::Exception.
255
256       $exception = dies { ... }
257       $bool = lives { ... }
258       $bool = try_ok { ... }
259
260   WARNINGS
261       See Test2::Tools::Warnings.
262
263       $count = warns { ... }
264       $warning = warning { ... }
265       $warnings_ref = warnings { ... }
266       $bool = no_warnings { ... }
267

SOURCE

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

MAINTAINERS

273       Chad Granum <exodist@cpan.org>
274

AUTHORS

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