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

SOURCE

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

MAINTAINERS

272       Chad Granum <exodist@cpan.org>
273

AUTHORS

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