Debian Codegraph @

upstream/mageia-cauldron/man3pm/Test2::Tools::Tiny.3pm

raw
1 .\" -*- mode: troff; coding: utf-8 -*-
2 .\" Automatically generated by Pod::Man v6.0.2 (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 .\" Required to disable full justification in groff 1.23.0.
57 .if n .ds AD l
58 .\" ========================================================================
59 .\"
60 .IX Title "Test2::Tools::Tiny 3pm"
61 .TH Test2::Tools::Tiny 3pm 2025-06-24 "perl v5.42.0" "Perl Programmers Reference Guide"
62 .\" For nroff, turn off justification. Always turn off hyphenation; it makes
63 .\" way too many mistakes in technical documents.
64 .if n .ad l
65 .nh
66 .SH NAME
67 Test2::Tools::Tiny \- Tiny set of tools for unfortunate souls who cannot use
68 Test2::Suite.
69 .SH DESCRIPTION
70 .IX Header "DESCRIPTION"
71 You should really look at Test2::Suite. This package is some very basic
72 essential tools implemented using Test2. This exists only so that Test2
73 and other tools required by Test2::Suite can be tested. This is the package
74 Test2 uses to test itself.
75 .SH "USE Test2::Suite INSTEAD"
76 .IX Header "USE Test2::Suite INSTEAD"
77 Use Test2::Suite if at all possible.
78 .SH EXPORTS
79 .IX Header "EXPORTS"
80 .ie n .IP "ok($bool, $name)" 4
81 .el .IP "ok($bool, \f(CW$name\fR)" 4
82 .IX Item "ok($bool, $name)"
83 .PD 0
84 .ie n .IP "ok($bool, $name, @diag)" 4
85 .el .IP "ok($bool, \f(CW$name\fR, \f(CW@diag\fR)" 4
86 .IX Item "ok($bool, $name, @diag)"
87 .PD
88 Run a simple assertion.
89 .ie n .IP "is($got, $want, $name)" 4
90 .el .IP "is($got, \f(CW$want\fR, \f(CW$name\fR)" 4
91 .IX Item "is($got, $want, $name)"
92 .PD 0
93 .ie n .IP "is($got, $want, $name, @diag)" 4
94 .el .IP "is($got, \f(CW$want\fR, \f(CW$name\fR, \f(CW@diag\fR)" 4
95 .IX Item "is($got, $want, $name, @diag)"
96 .PD
97 Assert that 2 strings are the same.
98 .ie n .IP "isnt($got, $do_not_want, $name)" 4
99 .el .IP "isnt($got, \f(CW$do_not_want\fR, \f(CW$name\fR)" 4
100 .IX Item "isnt($got, $do_not_want, $name)"
101 .PD 0
102 .ie n .IP "isnt($got, $do_not_want, $name, @diag)" 4
103 .el .IP "isnt($got, \f(CW$do_not_want\fR, \f(CW$name\fR, \f(CW@diag\fR)" 4
104 .IX Item "isnt($got, $do_not_want, $name, @diag)"
105 .PD
106 Assert that 2 strings are not the same.
107 .ie n .IP "like($got, $regex, $name)" 4
108 .el .IP "like($got, \f(CW$regex\fR, \f(CW$name\fR)" 4
109 .IX Item "like($got, $regex, $name)"
110 .PD 0
111 .ie n .IP "like($got, $regex, $name, @diag)" 4
112 .el .IP "like($got, \f(CW$regex\fR, \f(CW$name\fR, \f(CW@diag\fR)" 4
113 .IX Item "like($got, $regex, $name, @diag)"
114 .PD
115 Check that the input string matches the regex.
116 .ie n .IP "unlike($got, $regex, $name)" 4
117 .el .IP "unlike($got, \f(CW$regex\fR, \f(CW$name\fR)" 4
118 .IX Item "unlike($got, $regex, $name)"
119 .PD 0
120 .ie n .IP "unlike($got, $regex, $name, @diag)" 4
121 .el .IP "unlike($got, \f(CW$regex\fR, \f(CW$name\fR, \f(CW@diag\fR)" 4
122 .IX Item "unlike($got, $regex, $name, @diag)"
123 .PD
124 Check that the input string does not match the regex.
125 .ie n .IP "is_deeply($got, $want, $name)" 4
126 .el .IP "is_deeply($got, \f(CW$want\fR, \f(CW$name\fR)" 4
127 .IX Item "is_deeply($got, $want, $name)"
128 .PD 0
129 .ie n .IP "is_deeply($got, $want, $name, @diag)" 4
130 .el .IP "is_deeply($got, \f(CW$want\fR, \f(CW$name\fR, \f(CW@diag\fR)" 4
131 .IX Item "is_deeply($got, $want, $name, @diag)"
132 .PD
133 Check 2 data structures. Please note that this is a \fIDUMB\fR implementation that
134 compares the output of Data::Dumper against both structures.
135 .IP diag($msg) 4
136 .IX Item "diag($msg)"
137 Issue a diagnostics message to STDERR.
138 .IP note($msg) 4
139 .IX Item "note($msg)"
140 Issue a diagnostics message to STDOUT.
141 .IP skip_all($reason) 4
142 .IX Item "skip_all($reason)"
143 Skip all tests.
144 .ie n .IP "todo $reason => sub { ... }" 4
145 .el .IP "todo \f(CW$reason\fR => sub { ... }" 4
146 .IX Item "todo $reason => sub { ... }"
147 Run a block in TODO mode.
148 .IP plan($count) 4
149 .IX Item "plan($count)"
150 Set the plan.
151 .IP \fBdone_testing()\fR 4
152 .IX Item "done_testing()"
153 Set the plan to the current test count.
154 .ie n .IP "$warnings = warnings { ... }" 4
155 .el .IP "\f(CW$warnings\fR = warnings { ... }" 4
156 .IX Item "$warnings = warnings { ... }"
157 Capture an arrayref of warnings from the block.
158 .ie n .IP "$exception = exception { ... }" 4
159 .el .IP "\f(CW$exception\fR = exception { ... }" 4
160 .IX Item "$exception = exception { ... }"
161 Capture an exception.
162 .ie n .IP "tests $name => sub { ... }" 4
163 .el .IP "tests \f(CW$name\fR => sub { ... }" 4
164 .IX Item "tests $name => sub { ... }"
165 Run a subtest.
166 .ie n .IP "$output = capture { ... }" 4
167 .el .IP "\f(CW$output\fR = capture { ... }" 4
168 .IX Item "$output = capture { ... }"
169 Capture STDOUT and STDERR output.
170 .Sp
171 Result looks like this:
172 .Sp
173 .Vb 4
174 \& {
175 \& STDOUT => "...",
176 \& STDERR => "...",
177 \& }
178 .Ve
179 .SH SOURCE
180 .IX Header "SOURCE"
181 The source code repository for Test2 can be found at
182 <https://github.com/Test\-More/test\-more/>.
183 .SH MAINTAINERS
184 .IX Header "MAINTAINERS"
185 .IP "Chad Granum <[email protected]>" 4
186 .IX Item "Chad Granum <[email protected]>"
187 .SH AUTHORS
188 .IX Header "AUTHORS"
189 .IP "Chad Granum <[email protected]>" 4
190 .IX Item "Chad Granum <[email protected]>"
191 .SH COPYRIGHT
192 .IX Header "COPYRIGHT"
193 Copyright Chad Granum <[email protected]>.
194 .PP
195 This program is free software; you can redistribute it and/or
196 modify it under the same terms as Perl itself.
197 .PP
198 See <https://dev.perl.org/licenses/>