| 1 |
.\" -*- mode: troff; coding: utf-8 -*- |
| 2 |
.\" Automatically generated by Pod::Man 5.0102 (Pod::Simple 3.45) |
| 3 |
.\" |
| 4 |
.\" Standard preamble: |
| 5 |
.\" ======================================================================== |
| 6 |
.de Sp \" Vertical space (when we can't use .PP) |
| 7 |
.if t .sp .5v |
| 8 |
.if n .sp |
| 9 |
.. |
| 10 |
.de Vb \" Begin verbatim text |
| 11 |
.ft CW |
| 12 |
.nf |
| 13 |
.ne \\$1 |
| 14 |
.. |
| 15 |
.de Ve \" End verbatim text |
| 16 |
.ft R |
| 17 |
.fi |
| 18 |
.. |
| 19 |
.\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. |
| 20 |
.ie n \{\ |
| 21 |
. ds C` "" |
| 22 |
. ds C' "" |
| 23 |
'br\} |
| 24 |
.el\{\ |
| 25 |
. ds C` |
| 26 |
. ds C' |
| 27 |
'br\} |
| 28 |
.\" |
| 29 |
.\" Escape single quotes in literal strings from groff's Unicode transform. |
| 30 |
.ie \n(.g .ds Aq \(aq |
| 31 |
.el .ds Aq ' |
| 32 |
.\" |
| 33 |
.\" If the F register is >0, we'll generate index entries on stderr for |
| 34 |
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index |
| 35 |
.\" entries marked with X<> in POD. Of course, you'll have to process the |
| 36 |
.\" output yourself in some meaningful fashion. |
| 37 |
.\" |
| 38 |
.\" Avoid warning from groff about undefined register 'F'. |
| 39 |
.de IX |
| 40 |
.. |
| 41 |
.nr rF 0 |
| 42 |
.if \n(.g .if rF .nr rF 1 |
| 43 |
.if (\n(rF:(\n(.g==0)) \{\ |
| 44 |
. if \nF \{\ |
| 45 |
. de IX |
| 46 |
. tm Index:\\$1\t\\n%\t"\\$2" |
| 47 |
.. |
| 48 |
. if !\nF==2 \{\ |
| 49 |
. nr % 0 |
| 50 |
. nr F 2 |
| 51 |
. \} |
| 52 |
. \} |
| 53 |
.\} |
| 54 |
.rr rF |
| 55 |
.\" ======================================================================== |
| 56 |
.\" |
| 57 |
.IX Title "Test2::Bundle::More 3perl" |
| 58 |
.TH Test2::Bundle::More 3perl 2025-11-16 "perl v5.40.1" "Perl Programmers Reference Guide" |
| 59 |
.\" For nroff, turn off justification. Always turn off hyphenation; it makes |
| 60 |
.\" way too many mistakes in technical documents. |
| 61 |
.if n .ad l |
| 62 |
.nh |
| 63 |
.SH NAME |
| 64 |
Test2::Bundle::More \- ALMOST a drop\-in replacement for Test::More. |
| 65 |
.SH DESCRIPTION |
| 66 |
.IX Header "DESCRIPTION" |
| 67 |
This bundle is intended to be a (mostly) drop-in replacement for |
| 68 |
Test::More. See "KEY DIFFERENCES FROM Test::More" for details. |
| 69 |
.SH SYNOPSIS |
| 70 |
.IX Header "SYNOPSIS" |
| 71 |
.Vb 1 |
| 72 |
\& use Test2::Bundle::More; |
| 73 |
\& |
| 74 |
\& ok(1, "pass"); |
| 75 |
\& |
| 76 |
\& ... |
| 77 |
\& |
| 78 |
\& done_testing; |
| 79 |
.Ve |
| 80 |
.SH PLUGINS |
| 81 |
.IX Header "PLUGINS" |
| 82 |
This loads Test2::Plugin::ExitSummary. |
| 83 |
.SH TOOLS |
| 84 |
.IX Header "TOOLS" |
| 85 |
These are from Test2::Tools::Basic. See Test2::Tools::Basic for details. |
| 86 |
.ie n .IP "ok($bool, $name)" 4 |
| 87 |
.el .IP "ok($bool, \f(CW$name\fR)" 4 |
| 88 |
.IX Item "ok($bool, $name)" |
| 89 |
.PD 0 |
| 90 |
.IP pass($name) 4 |
| 91 |
.IX Item "pass($name)" |
| 92 |
.IP fail($name) 4 |
| 93 |
.IX Item "fail($name)" |
| 94 |
.ie n .IP "skip($why, $count)" 4 |
| 95 |
.el .IP "skip($why, \f(CW$count\fR)" 4 |
| 96 |
.IX Item "skip($why, $count)" |
| 97 |
.ie n .IP "$todo = todo($why)" 4 |
| 98 |
.el .IP "\f(CW$todo\fR = todo($why)" 4 |
| 99 |
.IX Item "$todo = todo($why)" |
| 100 |
.IP diag($message) 4 |
| 101 |
.IX Item "diag($message)" |
| 102 |
.IP note($message) 4 |
| 103 |
.IX Item "note($message)" |
| 104 |
.IP plan($count) 4 |
| 105 |
.IX Item "plan($count)" |
| 106 |
.IP skip_all($why) 4 |
| 107 |
.IX Item "skip_all($why)" |
| 108 |
.IP \fBdone_testing()\fR 4 |
| 109 |
.IX Item "done_testing()" |
| 110 |
.IP BAIL_OUT($why) 4 |
| 111 |
.IX Item "BAIL_OUT($why)" |
| 112 |
.PD |
| 113 |
.PP |
| 114 |
These are from Test2::Tools::ClassicCompare. See |
| 115 |
Test2::Tools::ClassicCompare for details. |
| 116 |
.ie n .IP "is($got, $want, $name)" 4 |
| 117 |
.el .IP "is($got, \f(CW$want\fR, \f(CW$name\fR)" 4 |
| 118 |
.IX Item "is($got, $want, $name)" |
| 119 |
.PD 0 |
| 120 |
.ie n .IP "isnt($got, $donotwant, $name)" 4 |
| 121 |
.el .IP "isnt($got, \f(CW$donotwant\fR, \f(CW$name\fR)" 4 |
| 122 |
.IX Item "isnt($got, $donotwant, $name)" |
| 123 |
.ie n .IP "like($got, qr/match/, $name)" 4 |
| 124 |
.el .IP "like($got, qr/match/, \f(CW$name\fR)" 4 |
| 125 |
.IX Item "like($got, qr/match/, $name)" |
| 126 |
.ie n .IP "unlike($got, qr/mismatch/, $name)" 4 |
| 127 |
.el .IP "unlike($got, qr/mismatch/, \f(CW$name\fR)" 4 |
| 128 |
.IX Item "unlike($got, qr/mismatch/, $name)" |
| 129 |
.ie n .IP "is_deeply($got, $want, ""Deep compare"")" 4 |
| 130 |
.el .IP "is_deeply($got, \f(CW$want\fR, ""Deep compare"")" 4 |
| 131 |
.IX Item "is_deeply($got, $want, ""Deep compare"")" |
| 132 |
.ie n .IP "cmp_ok($got, $op, $want, $name)" 4 |
| 133 |
.el .IP "cmp_ok($got, \f(CW$op\fR, \f(CW$want\fR, \f(CW$name\fR)" 4 |
| 134 |
.IX Item "cmp_ok($got, $op, $want, $name)" |
| 135 |
.PD |
| 136 |
.PP |
| 137 |
These are from Test2::Tools::Class. See Test2::Tools::Class for details. |
| 138 |
.ie n .IP "isa_ok($thing, @classes)" 4 |
| 139 |
.el .IP "isa_ok($thing, \f(CW@classes\fR)" 4 |
| 140 |
.IX Item "isa_ok($thing, @classes)" |
| 141 |
.PD 0 |
| 142 |
.ie n .IP "can_ok($thing, @subs)" 4 |
| 143 |
.el .IP "can_ok($thing, \f(CW@subs\fR)" 4 |
| 144 |
.IX Item "can_ok($thing, @subs)" |
| 145 |
.PD |
| 146 |
.PP |
| 147 |
This is from Test2::Tools::Subtest. It is called \f(CWsubtest_streamed()\fR in |
| 148 |
that package. |
| 149 |
.ie n .IP "subtest $name => sub { ... }" 4 |
| 150 |
.el .IP "subtest \f(CW$name\fR => sub { ... }" 4 |
| 151 |
.IX Item "subtest $name => sub { ... }" |
| 152 |
.SH "KEY DIFFERENCES FROM Test::More" |
| 153 |
.IX Header "KEY DIFFERENCES FROM Test::More" |
| 154 |
.PD 0 |
| 155 |
.IP "You cannot plan at import." 4 |
| 156 |
.IX Item "You cannot plan at import." |
| 157 |
.PD |
| 158 |
THIS WILL \fBNOT\fR WORK: |
| 159 |
.Sp |
| 160 |
.Vb 1 |
| 161 |
\& use Test2::Bundle::More tests => 5; |
| 162 |
.Ve |
| 163 |
.Sp |
| 164 |
Instead you must plan in a separate statement: |
| 165 |
.Sp |
| 166 |
.Vb 2 |
| 167 |
\& use Test2::Bundle::More; |
| 168 |
\& plan 5; |
| 169 |
.Ve |
| 170 |
.IP "You have three subs imported for use in planning" 4 |
| 171 |
.IX Item "You have three subs imported for use in planning" |
| 172 |
Use \f(CWplan($count)\fR, \f(CWskip_all($reason)\fR, or \f(CWdone_testing()\fR for your |
| 173 |
planning. |
| 174 |
.IP "isa_ok accepts different arguments" 4 |
| 175 |
.IX Item "isa_ok accepts different arguments" |
| 176 |
\&\f(CW\*(C`isa_ok\*(C'\fR in Test::More was: |
| 177 |
.Sp |
| 178 |
.Vb 1 |
| 179 |
\& isa_ok($thing, $isa, $alt_thing_name); |
| 180 |
.Ve |
| 181 |
.Sp |
| 182 |
This was very inconsistent with tools like \f(CW\*(C`can_ok($thing, @subs)\*(C'\fR. |
| 183 |
.Sp |
| 184 |
In Test2::Bundle::More, \f(CWisa_ok()\fR takes a \f(CW$thing\fR and a list of \f(CW@isa\fR. |
| 185 |
.Sp |
| 186 |
.Vb 1 |
| 187 |
\& isa_ok($thing, $class1, $class2, ...); |
| 188 |
.Ve |
| 189 |
.SS "THESE FUNCTIONS AND VARIABLES HAVE BEEN REMOVED" |
| 190 |
.IX Subsection "THESE FUNCTIONS AND VARIABLES HAVE BEEN REMOVED" |
| 191 |
.ie n .IP $TODO 4 |
| 192 |
.el .IP \f(CW$TODO\fR 4 |
| 193 |
.IX Item "$TODO" |
| 194 |
See \f(CWtodo()\fR. |
| 195 |
.IP \fBuse_ok()\fR 4 |
| 196 |
.IX Item "use_ok()" |
| 197 |
.PD 0 |
| 198 |
.IP \fBrequire_ok()\fR 4 |
| 199 |
.IX Item "require_ok()" |
| 200 |
.PD |
| 201 |
These are not necessary. Use \f(CW\*(C`use\*(C'\fR and \f(CW\*(C`require\*(C'\fR directly. If there is an |
| 202 |
error loading the module the test will catch the error and fail. |
| 203 |
.IP \fBtodo_skip()\fR 4 |
| 204 |
.IX Item "todo_skip()" |
| 205 |
Not necessary. |
| 206 |
.IP \fBeq_array()\fR 4 |
| 207 |
.IX Item "eq_array()" |
| 208 |
.PD 0 |
| 209 |
.IP \fBeq_hash()\fR 4 |
| 210 |
.IX Item "eq_hash()" |
| 211 |
.IP \fBeq_set()\fR 4 |
| 212 |
.IX Item "eq_set()" |
| 213 |
.PD |
| 214 |
Discouraged in Test::More. |
| 215 |
.IP \fBexplain()\fR 4 |
| 216 |
.IX Item "explain()" |
| 217 |
This started a fight between Test developers, who may now each write their own |
| 218 |
implementations in Test2. (See explain in Test::Most vs Test::More. |
| 219 |
Hint: Test::Most wrote it first, then Test::More added it, but broke |
| 220 |
compatibility). |
| 221 |
.IP \fBnew_ok()\fR 4 |
| 222 |
.IX Item "new_ok()" |
| 223 |
Not necessary. |
| 224 |
.SH SOURCE |
| 225 |
.IX Header "SOURCE" |
| 226 |
The source code repository for Test2\-Suite can be found at |
| 227 |
\&\fIhttps://github.com/Test\-More/Test2\-Suite/\fR. |
| 228 |
.SH MAINTAINERS |
| 229 |
.IX Header "MAINTAINERS" |
| 230 |
.IP "Chad Granum <[email protected]>" 4 |
| 231 |
.IX Item "Chad Granum <[email protected]>" |
| 232 |
.SH AUTHORS |
| 233 |
.IX Header "AUTHORS" |
| 234 |
.PD 0 |
| 235 |
.IP "Chad Granum <[email protected]>" 4 |
| 236 |
.IX Item "Chad Granum <[email protected]>" |
| 237 |
.PD |
| 238 |
.SH COPYRIGHT |
| 239 |
.IX Header "COPYRIGHT" |
| 240 |
Copyright 2018 Chad Granum <[email protected]>. |
| 241 |
.PP |
| 242 |
This program is free software; you can redistribute it and/or |
| 243 |
modify it under the same terms as Perl itself. |
| 244 |
.PP |
| 245 |
See \fIhttp://dev.perl.org/licenses/\fR |