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

SOURCE

261       The source code repository for Test2-Suite can be found at
262       https://github.com/Test-More/Test2-Suite/.
263

MAINTAINERS

265       Chad Granum <exodist@cpan.org>
266

AUTHORS

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