Debian Codegraph @

upstream/debian-unstable/man3/Test2::Util::Facets2Legacy.3perl

raw
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::Util::Facets2Legacy 3perl"
58 .TH Test2::Util::Facets2Legacy 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::Util::Facets2Legacy \- Convert facet data to the legacy event API.
65 .SH DESCRIPTION
66 .IX Header "DESCRIPTION"
67 This module exports several subroutines from the older event API (see
68 Test2::Event). These subroutines can be used as methods on any object that
69 provides a custom \f(CWfacet_data()\fR method. These subroutines can also be used as
70 functions that take a facet data hashref as arguments.
71 .SH SYNOPSIS
72 .IX Header "SYNOPSIS"
73 .SS "AS METHODS"
74 .IX Subsection "AS METHODS"
75 .Vb 1
76 \& package My::Event;
77 \&
78 \& use Test2::Util::Facets2Legacy \*(Aq:ALL\*(Aq;
79 \&
80 \& sub facet_data { return { ... } }
81 .Ve
82 .PP
83 Then to use it:
84 .PP
85 .Vb 1
86 \& my $e = My::Event\->new(...);
87 \&
88 \& my $causes_fail = $e\->causes_fail;
89 \& my $summary = $e\->summary;
90 \& ....
91 .Ve
92 .SS "AS FUNCTIONS"
93 .IX Subsection "AS FUNCTIONS"
94 .Vb 1
95 \& use Test2::Util::Facets2Legacy \*(Aq:ALL\*(Aq;
96 \&
97 \& my $f = {
98 \& assert => { ... },
99 \& info => [{...}, ...],
100 \& control => {...},
101 \& ...
102 \& };
103 \&
104 \& my $causes_fail = causes_fail($f);
105 \& my $summary = summary($f);
106 .Ve
107 .SH "NOTE ON CYCLES"
108 .IX Header "NOTE ON CYCLES"
109 When used as methods, all these subroutines call \f(CW\*(C`$e\->facet_data()\*(C'\fR. The
110 default \f(CWfacet_data()\fR method in Test2::Event relies on the legacy methods
111 this module emulates in order to work. As a result of this it is very easy to
112 create infinite recursion bugs.
113 .PP
114 These methods have cycle detection and will throw an exception early if a cycle
115 is detected. \f(CWuuid()\fR is currently the only subroutine in this library that
116 has a fallback behavior when cycles are detected.
117 .SH EXPORTS
118 .IX Header "EXPORTS"
119 Nothing is exported by default. You must specify which methods to import, or
120 use the ':ALL' tag.
121 .ie n .IP "$bool = $e\->\fBcauses_fail()\fR" 4
122 .el .IP "\f(CW$bool\fR = \f(CW$e\fR\->\fBcauses_fail()\fR" 4
123 .IX Item "$bool = $e->causes_fail()"
124 .PD 0
125 .ie n .IP "$bool = causes_fail($f)" 4
126 .el .IP "\f(CW$bool\fR = causes_fail($f)" 4
127 .IX Item "$bool = causes_fail($f)"
128 .PD
129 Check if the event or facets result in a failing state.
130 .ie n .IP "$bool = $e\->\fBdiagnostics()\fR" 4
131 .el .IP "\f(CW$bool\fR = \f(CW$e\fR\->\fBdiagnostics()\fR" 4
132 .IX Item "$bool = $e->diagnostics()"
133 .PD 0
134 .ie n .IP "$bool = diagnostics($f)" 4
135 .el .IP "\f(CW$bool\fR = diagnostics($f)" 4
136 .IX Item "$bool = diagnostics($f)"
137 .PD
138 Check if the event or facets contain any diagnostics information.
139 .ie n .IP "$bool = $e\->\fBglobal()\fR" 4
140 .el .IP "\f(CW$bool\fR = \f(CW$e\fR\->\fBglobal()\fR" 4
141 .IX Item "$bool = $e->global()"
142 .PD 0
143 .ie n .IP "$bool = global($f)" 4
144 .el .IP "\f(CW$bool\fR = global($f)" 4
145 .IX Item "$bool = global($f)"
146 .PD
147 Check if the event or facets need to be globally processed.
148 .ie n .IP "$bool = $e\->\fBincrements_count()\fR" 4
149 .el .IP "\f(CW$bool\fR = \f(CW$e\fR\->\fBincrements_count()\fR" 4
150 .IX Item "$bool = $e->increments_count()"
151 .PD 0
152 .ie n .IP "$bool = increments_count($f)" 4
153 .el .IP "\f(CW$bool\fR = increments_count($f)" 4
154 .IX Item "$bool = increments_count($f)"
155 .PD
156 Check if the event or facets make an assertion.
157 .ie n .IP "$bool = $e\->\fBno_display()\fR" 4
158 .el .IP "\f(CW$bool\fR = \f(CW$e\fR\->\fBno_display()\fR" 4
159 .IX Item "$bool = $e->no_display()"
160 .PD 0
161 .ie n .IP "$bool = no_display($f)" 4
162 .el .IP "\f(CW$bool\fR = no_display($f)" 4
163 .IX Item "$bool = no_display($f)"
164 .PD
165 Check if the event or facets should be rendered or hidden.
166 .ie n .IP "($max, $directive, $reason) = $e\->\fBsets_plan()\fR" 4
167 .el .IP "($max, \f(CW$directive\fR, \f(CW$reason\fR) = \f(CW$e\fR\->\fBsets_plan()\fR" 4
168 .IX Item "($max, $directive, $reason) = $e->sets_plan()"
169 .PD 0
170 .ie n .IP "($max, $directive, $reason) = sets_plan($f)" 4
171 .el .IP "($max, \f(CW$directive\fR, \f(CW$reason\fR) = sets_plan($f)" 4
172 .IX Item "($max, $directive, $reason) = sets_plan($f)"
173 .PD
174 Check if the event or facets set a plan, and return the plan details.
175 .ie n .IP "$id = $e\->\fBsubtest_id()\fR" 4
176 .el .IP "\f(CW$id\fR = \f(CW$e\fR\->\fBsubtest_id()\fR" 4
177 .IX Item "$id = $e->subtest_id()"
178 .PD 0
179 .ie n .IP "$id = subtest_id($f)" 4
180 .el .IP "\f(CW$id\fR = subtest_id($f)" 4
181 .IX Item "$id = subtest_id($f)"
182 .PD
183 Get the subtest id, if any.
184 .ie n .IP "$string = $e\->\fBsummary()\fR" 4
185 .el .IP "\f(CW$string\fR = \f(CW$e\fR\->\fBsummary()\fR" 4
186 .IX Item "$string = $e->summary()"
187 .PD 0
188 .ie n .IP "$string = summary($f)" 4
189 .el .IP "\f(CW$string\fR = summary($f)" 4
190 .IX Item "$string = summary($f)"
191 .PD
192 Get the summary of the event or facets hash, if any.
193 .ie n .IP "$undef_or_int = $e\->\fBterminate()\fR" 4
194 .el .IP "\f(CW$undef_or_int\fR = \f(CW$e\fR\->\fBterminate()\fR" 4
195 .IX Item "$undef_or_int = $e->terminate()"
196 .PD 0
197 .ie n .IP "$undef_or_int = terminate($f)" 4
198 .el .IP "\f(CW$undef_or_int\fR = terminate($f)" 4
199 .IX Item "$undef_or_int = terminate($f)"
200 .PD
201 Check if the event or facets should result in process termination, if so the
202 exit code is returned (which could be 0). undef is returned if no termination
203 is requested.
204 .ie n .IP "$uuid = $e\->\fBuuid()\fR" 4
205 .el .IP "\f(CW$uuid\fR = \f(CW$e\fR\->\fBuuid()\fR" 4
206 .IX Item "$uuid = $e->uuid()"
207 .PD 0
208 .ie n .IP "$uuid = uuid($f)" 4
209 .el .IP "\f(CW$uuid\fR = uuid($f)" 4
210 .IX Item "$uuid = uuid($f)"
211 .PD
212 Get the UUID of the facets or event.
213 .Sp
214 \&\fBNote:\fR This will fall back to \f(CW\*(C`$e\->SUPER::uuid()\*(C'\fR if a cycle is
215 detected and an event is used as the argument.
216 .SH SOURCE
217 .IX Header "SOURCE"
218 The source code repository for Test2 can be found at
219 <https://github.com/Test\-More/test\-more/>.
220 .SH MAINTAINERS
221 .IX Header "MAINTAINERS"
222 .IP "Chad Granum <[email protected]>" 4
223 .IX Item "Chad Granum <[email protected]>"
224 .SH AUTHORS
225 .IX Header "AUTHORS"
226 .PD 0
227 .IP "Chad Granum <[email protected]>" 4
228 .IX Item "Chad Granum <[email protected]>"
229 .PD
230 .SH COPYRIGHT
231 .IX Header "COPYRIGHT"
232 Copyright 2020 Chad Granum <[email protected]>.
233 .PP
234 This program is free software; you can redistribute it and/or
235 modify it under the same terms as Perl itself.
236 .PP
237 See <https://dev.perl.org/licenses/>