| 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::API::InterceptResult::Event 3perl" |
| 58 |
.TH Test2::API::InterceptResult::Event 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::API::InterceptResult::Event \- Representation of an event for use in |
| 65 |
testing other test tools. |
| 66 |
.SH DESCRIPTION |
| 67 |
.IX Header "DESCRIPTION" |
| 68 |
\&\f(CW\*(C`intercept { ... }\*(C'\fR from Test2::API returns an instance of |
| 69 |
Test2::API::InterceptResult which is a blessed arrayref of |
| 70 |
Test2::API::InterceptResult::Event objects. |
| 71 |
.PP |
| 72 |
This POD documents the methods of these events, which are mainly provided for |
| 73 |
you to use when testing your test tools. |
| 74 |
.SH SYNOPSIS |
| 75 |
.IX Header "SYNOPSIS" |
| 76 |
.Vb 2 |
| 77 |
\& use Test2::V0; |
| 78 |
\& use Test2::API qw/intercept/; |
| 79 |
\& |
| 80 |
\& my $events = intercept { |
| 81 |
\& ok(1, "A passing assertion"); |
| 82 |
\& plan(1); |
| 83 |
\& }; |
| 84 |
\& |
| 85 |
\& # This will convert all events into instances of |
| 86 |
\& # Test2::API::InterceptResult::Event. Until we do this they are the |
| 87 |
\& # original Test::Event::* instances |
| 88 |
\& $events\->upgrade(in_place => 1); |
| 89 |
\& |
| 90 |
\& # Now we can get individual events in this form |
| 91 |
\& my $assert = $events\->[0]; |
| 92 |
\& my $plan = $events\->[1]; |
| 93 |
\& |
| 94 |
\& # Or we can operate on all events at once: |
| 95 |
\& my $flattened = $events\->flatten; |
| 96 |
\& is( |
| 97 |
\& $flattened, |
| 98 |
\& [ |
| 99 |
\& { |
| 100 |
\& causes_failure => 0, |
| 101 |
\& |
| 102 |
\& name => \*(AqA passing assertion\*(Aq, |
| 103 |
\& pass => 1, |
| 104 |
\& |
| 105 |
\& trace_file => \*(Aqxxx.t\*(Aq, |
| 106 |
\& trace_line => 5, |
| 107 |
\& }, |
| 108 |
\& { |
| 109 |
\& causes_failure => 0, |
| 110 |
\& |
| 111 |
\& plan => 1, |
| 112 |
\& |
| 113 |
\& trace_file => \*(Aqxxx.t\*(Aq, |
| 114 |
\& trace_line => 6, |
| 115 |
\& }, |
| 116 |
\& ], |
| 117 |
\& "Flattened both events and returned an arrayref of the results |
| 118 |
\& ); |
| 119 |
.Ve |
| 120 |
.SH METHODS |
| 121 |
.IX Header "METHODS" |
| 122 |
.SS "!!! IMPORTANT NOTES ON DESIGN !!!" |
| 123 |
.IX Subsection "!!! IMPORTANT NOTES ON DESIGN !!!" |
| 124 |
Please pay attention to what these return, many return a scalar when |
| 125 |
applicable or an empty list when not (as opposed to undef). Many also always |
| 126 |
return a list of 0 or more items. Some always return a scalar. Note that none |
| 127 |
of the methods care about context, their behavior is consistent regardless of |
| 128 |
scalar, list, or void context. |
| 129 |
.PP |
| 130 |
This was done because this class was specifically designed to be used in a list |
| 131 |
and generate more lists in bulk operations. Sometimes in a map you want nothing |
| 132 |
to show up for the event, and you do not want an undef in its place. In general |
| 133 |
single event instances are not going to be used alone, though that is allowed. |
| 134 |
.PP |
| 135 |
As a general rule any method prefixed with \f(CW\*(C`the_\*(C'\fR implies the event should |
| 136 |
have exactly 1 of the specified item, and and exception will be thrown if there |
| 137 |
are 0, or more than 1 of the item. |
| 138 |
.SS ATTRIBUTES |
| 139 |
.IX Subsection "ATTRIBUTES" |
| 140 |
.ie n .IP "$hashref = $event\->facet_data" 4 |
| 141 |
.el .IP "\f(CW$hashref\fR = \f(CW$event\fR\->facet_data" 4 |
| 142 |
.IX Item "$hashref = $event->facet_data" |
| 143 |
This will return the facet data hashref, which is all Test2 cares about for any |
| 144 |
given event. |
| 145 |
.ie n .IP "$class = $event\->result_class" 4 |
| 146 |
.el .IP "\f(CW$class\fR = \f(CW$event\fR\->result_class" 4 |
| 147 |
.IX Item "$class = $event->result_class" |
| 148 |
This is normally Test2::API::InterceptResult. This is set at construction so |
| 149 |
that subtest results can be turned into instances of it on demand. |
| 150 |
.SS DUPLICATION |
| 151 |
.IX Subsection "DUPLICATION" |
| 152 |
.ie n .IP "$copy = $event\->clone" 4 |
| 153 |
.el .IP "\f(CW$copy\fR = \f(CW$event\fR\->clone" 4 |
| 154 |
.IX Item "$copy = $event->clone" |
| 155 |
Create a deep copy of the event. Modifying either event will not effect the |
| 156 |
other. |
| 157 |
.SS "CONDENSED MULTI-FACET DATA" |
| 158 |
.IX Subsection "CONDENSED MULTI-FACET DATA" |
| 159 |
.ie n .IP "$bool = $event\->causes_failure" 4 |
| 160 |
.el .IP "\f(CW$bool\fR = \f(CW$event\fR\->causes_failure" 4 |
| 161 |
.IX Item "$bool = $event->causes_failure" |
| 162 |
.PD 0 |
| 163 |
.ie n .IP "$bool = $event\->causes_fail" 4 |
| 164 |
.el .IP "\f(CW$bool\fR = \f(CW$event\fR\->causes_fail" 4 |
| 165 |
.IX Item "$bool = $event->causes_fail" |
| 166 |
.PD |
| 167 |
These are both aliases of the same functionality. |
| 168 |
.Sp |
| 169 |
This will always return either a true value, or a false value. This never |
| 170 |
returns a list. |
| 171 |
.Sp |
| 172 |
This method may be relatively slow (still super fast) because it determines |
| 173 |
pass or fail by creating an instance of Test2::Hub and asking it to process |
| 174 |
the event, and then asks the hub for its pass/fail state. This is slower than |
| 175 |
building in logic to do the check, but it is more reliable as it will always |
| 176 |
tell you what the hub thinks, so the logic will never be out of date relative |
| 177 |
to the Test2 logic that actually cares. |
| 178 |
.ie n .IP "STRING_OR_EMPTY_LIST = $event\->brief" 4 |
| 179 |
.el .IP "STRING_OR_EMPTY_LIST = \f(CW$event\fR\->brief" 4 |
| 180 |
.IX Item "STRING_OR_EMPTY_LIST = $event->brief" |
| 181 |
Not all events have a brief, some events are not rendered by the formatter, |
| 182 |
others have no "brief" data worth seeing. When this is the case an empty list |
| 183 |
is returned. This is done intentionally so it can be used in a map operation |
| 184 |
without having \f(CW\*(C`undef\*(C'\fR being included in the result. |
| 185 |
.Sp |
| 186 |
When a brief can be generated it is always a single 1\-line string, and is |
| 187 |
returned as-is, not in a list. |
| 188 |
.Sp |
| 189 |
Possible briefs: |
| 190 |
.Sp |
| 191 |
.Vb 3 |
| 192 |
\& # From control facets |
| 193 |
\& "BAILED OUT" |
| 194 |
\& "BAILED OUT: $why" |
| 195 |
\& |
| 196 |
\& # From error facets |
| 197 |
\& "ERROR" |
| 198 |
\& "ERROR: $message" |
| 199 |
\& "ERROR: $partial_message [...]" |
| 200 |
\& "ERRORS: $first_error_message [...]" |
| 201 |
\& |
| 202 |
\& # From assert facets |
| 203 |
\& "PASS" |
| 204 |
\& "FAIL" |
| 205 |
\& "PASS with amnesty" |
| 206 |
\& "FAIL with amnesty" |
| 207 |
\& |
| 208 |
\& # From plan facets |
| 209 |
\& "PLAN $count" |
| 210 |
\& "NO PLAN" |
| 211 |
\& "SKIP ALL" |
| 212 |
\& "SKIP ALL: $why" |
| 213 |
.Ve |
| 214 |
.Sp |
| 215 |
Note that only the first applicable brief is returned. This is essnetially a |
| 216 |
poor-mans TAP that only includes facets that could (but not necessarily do) |
| 217 |
cause a failure. |
| 218 |
.ie n .IP "$hashref = $event\->flatten" 4 |
| 219 |
.el .IP "\f(CW$hashref\fR = \f(CW$event\fR\->flatten" 4 |
| 220 |
.IX Item "$hashref = $event->flatten" |
| 221 |
.PD 0 |
| 222 |
.ie n .IP "$hashref = $event\->flatten(include_subevents => 1)" 4 |
| 223 |
.el .IP "\f(CW$hashref\fR = \f(CW$event\fR\->flatten(include_subevents => 1)" 4 |
| 224 |
.IX Item "$hashref = $event->flatten(include_subevents => 1)" |
| 225 |
.PD |
| 226 |
This ALWAYS returns a hashref. This puts all the most useful data for the most |
| 227 |
interesting facets into a single hashref for easy validation. |
| 228 |
.Sp |
| 229 |
If there are no meaningful facets this will return an empty hashref. |
| 230 |
.Sp |
| 231 |
If given the 'include_subevents' parameter it will also include subtest data: |
| 232 |
.Sp |
| 233 |
Here is a list of EVERY possible field. If a field is not applicable it will |
| 234 |
not be present. |
| 235 |
.RS 4 |
| 236 |
.IP "always present" 4 |
| 237 |
.IX Item "always present" |
| 238 |
.Vb 1 |
| 239 |
\& causes_failure => 1, # Always present |
| 240 |
.Ve |
| 241 |
.IP "Present if the event has a trace facet" 4 |
| 242 |
.IX Item "Present if the event has a trace facet" |
| 243 |
.Vb 3 |
| 244 |
\& trace_line => 42, |
| 245 |
\& trace_file => \*(AqFoo/Bar.pm\*(Aq, |
| 246 |
\& trace_details => \*(AqExtra trace details\*(Aq, # usually not present |
| 247 |
.Ve |
| 248 |
.IP "If an assertion is present" 4 |
| 249 |
.IX Item "If an assertion is present" |
| 250 |
.Vb 2 |
| 251 |
\& pass => 0, |
| 252 |
\& name => "1 + 1 = 2, so math works", |
| 253 |
.Ve |
| 254 |
.IP "If a plan is present:" 4 |
| 255 |
.IX Item "If a plan is present:" |
| 256 |
.Vb 1 |
| 257 |
\& plan => $count_or_SKIP_ALL_or_NO_PLAN, |
| 258 |
.Ve |
| 259 |
.IP "If amnesty facets are present" 4 |
| 260 |
.IX Item "If amnesty facets are present" |
| 261 |
You get an array for each type that is present. |
| 262 |
.Sp |
| 263 |
.Vb 4 |
| 264 |
\& todo => [ # Yes you could be under multiple todos, this will list them all. |
| 265 |
\& "I will fix this later", |
| 266 |
\& "I promise to fix these", |
| 267 |
\& ], |
| 268 |
\& |
| 269 |
\& skip => ["This will format the main drive, do not run"], |
| 270 |
\& |
| 271 |
\& ... => ["Other amnesty"] |
| 272 |
.Ve |
| 273 |
.IP "If Info (note/diag) facets are present" 4 |
| 274 |
.IX Item "If Info (note/diag) facets are present" |
| 275 |
You get an arrayref for any that are present, the key is not defined if they are not present. |
| 276 |
.Sp |
| 277 |
.Vb 4 |
| 278 |
\& diag => [ |
| 279 |
\& "Test failed at Foo/Bar.pm line 42", |
| 280 |
\& "You forgot to tie your boots", |
| 281 |
\& ], |
| 282 |
\& |
| 283 |
\& note => ["Your boots are red"], |
| 284 |
\& |
| 285 |
\& ... => ["Other info"], |
| 286 |
.Ve |
| 287 |
.IP "If error facets are present" 4 |
| 288 |
.IX Item "If error facets are present" |
| 289 |
Always an arrayref |
| 290 |
.Sp |
| 291 |
.Vb 4 |
| 292 |
\& error => [ |
| 293 |
\& "non fatal error (does not cause test failure, just an FYI", |
| 294 |
\& "FATAL: This is a fatal error (causes failure)", |
| 295 |
\& ], |
| 296 |
\& |
| 297 |
\& # Errors can have alternative tags, but in practice are always \*(Aqerror\*(Aq, |
| 298 |
\& # listing this for completeness. |
| 299 |
\& ... => [ ... ] |
| 300 |
.Ve |
| 301 |
.IP "Present if the event is a subtest" 4 |
| 302 |
.IX Item "Present if the event is a subtest" |
| 303 |
.Vb 5 |
| 304 |
\& subtest => { |
| 305 |
\& count => 2, # Number of assertions made |
| 306 |
\& failed => 1, # Number of test failures seen |
| 307 |
\& is_passing => 0, # Boolean, true if the test would be passing |
| 308 |
\& # after the events are processed. |
| 309 |
\& |
| 310 |
\& plan => 2, # Plan, either a number, undef, \*(AqSKIP\*(Aq, or \*(AqNO PLAN\*(Aq |
| 311 |
\& follows_plan => 1, # True if there is a plan and it was followed. |
| 312 |
\& # False if the plan and assertions did not |
| 313 |
\& # match, undef if no plan was present in the |
| 314 |
\& # event list. |
| 315 |
\& |
| 316 |
\& bailed_out => "foo", # if there was a bail\-out in the |
| 317 |
\& # events in this will be a string explaining |
| 318 |
\& # why there was a bailout, if no reason was |
| 319 |
\& # given this will simply be set to true (1). |
| 320 |
\& |
| 321 |
\& skip_reason => "foo", # If there was a skip_all this will give the |
| 322 |
\& # reason. |
| 323 |
\& }, |
| 324 |
.Ve |
| 325 |
.Sp |
| 326 |
if \f(CW\*(C`(include_subtest => 1)\*(C'\fR was provided as a parameter then the following |
| 327 |
will be included. This is the result of turning all subtest child events into |
| 328 |
an Test2::API::InterceptResult instance and calling the \f(CW\*(C`flatten\*(C'\fR method on |
| 329 |
it. |
| 330 |
.Sp |
| 331 |
.Vb 1 |
| 332 |
\& subevents => Test2::API::InterceptResult\->new(@child_events)\->flatten(...), |
| 333 |
.Ve |
| 334 |
.IP "If a bail-out is being requested" 4 |
| 335 |
.IX Item "If a bail-out is being requested" |
| 336 |
If no reason was given this will be set to 1. |
| 337 |
.Sp |
| 338 |
.Vb 1 |
| 339 |
\& bailed_out => "reason", |
| 340 |
.Ve |
| 341 |
.RE |
| 342 |
.RS 4 |
| 343 |
.RE |
| 344 |
.ie n .IP "$hashref = $event\->\fBsummary()\fR" 4 |
| 345 |
.el .IP "\f(CW$hashref\fR = \f(CW$event\fR\->\fBsummary()\fR" 4 |
| 346 |
.IX Item "$hashref = $event->summary()" |
| 347 |
This returns a limited summary. See \f(CWflatten()\fR, which is usually a better |
| 348 |
option. |
| 349 |
.Sp |
| 350 |
.Vb 2 |
| 351 |
\& { |
| 352 |
\& brief => $event\->brief || \*(Aq\*(Aq, |
| 353 |
\& |
| 354 |
\& causes_failure => $event\->causes_failure, |
| 355 |
\& |
| 356 |
\& trace_line => $event\->trace_line, |
| 357 |
\& trace_file => $event\->trace_file, |
| 358 |
\& trace_tool => $event\->trace_subname, |
| 359 |
\& trace_details => $event\->trace_details, |
| 360 |
\& |
| 361 |
\& facets => [ sort keys(%{$event\->{+FACET_DATA}}) ], |
| 362 |
\& } |
| 363 |
.Ve |
| 364 |
.SS "DIRECT ARBITRARY FACET ACCESS" |
| 365 |
.IX Subsection "DIRECT ARBITRARY FACET ACCESS" |
| 366 |
.ie n .IP "@list_of_facets = $event\->facet($name)" 4 |
| 367 |
.el .IP "\f(CW@list_of_facets\fR = \f(CW$event\fR\->facet($name)" 4 |
| 368 |
.IX Item "@list_of_facets = $event->facet($name)" |
| 369 |
This always returns a list of 0 or more items. This fetches the facet instances |
| 370 |
from the event. For facets like 'assert' this will always return 0 or 1 |
| 371 |
item. For events like 'info' (diags, notes) this will return 0 or more |
| 372 |
instances, once for each instance of the facet. |
| 373 |
.Sp |
| 374 |
These will be blessed into the proper Test2::EventFacet subclass. If no |
| 375 |
subclass can be found it will be blessed as an |
| 376 |
Test2::API::InterceptResult::Facet generic facet class. |
| 377 |
.ie n .IP "$undef_or_facet = $event\->the_facet($name)" 4 |
| 378 |
.el .IP "\f(CW$undef_or_facet\fR = \f(CW$event\fR\->the_facet($name)" 4 |
| 379 |
.IX Item "$undef_or_facet = $event->the_facet($name)" |
| 380 |
If you know you will have exactly 1 instance of a facet you can call this. |
| 381 |
.Sp |
| 382 |
If you are correct and there is exactly one instance of the facet it will |
| 383 |
always return the hashref. |
| 384 |
.Sp |
| 385 |
If there are 0 instances of the facet this will return undef, not an empty |
| 386 |
list. |
| 387 |
.Sp |
| 388 |
If there are more than 1 instance this will throw an exception because your |
| 389 |
assumption was incorrect. |
| 390 |
.SS "TRACE FACET" |
| 391 |
.IX Subsection "TRACE FACET" |
| 392 |
.ie n .IP "@list_of_facets = $event\->trace" 4 |
| 393 |
.el .IP "\f(CW@list_of_facets\fR = \f(CW$event\fR\->trace" 4 |
| 394 |
.IX Item "@list_of_facets = $event->trace" |
| 395 |
TODO |
| 396 |
.ie n .IP "$undef_or_hashref = $event\->the_trace" 4 |
| 397 |
.el .IP "\f(CW$undef_or_hashref\fR = \f(CW$event\fR\->the_trace" 4 |
| 398 |
.IX Item "$undef_or_hashref = $event->the_trace" |
| 399 |
This returns the trace hashref, or undef if it is not present. |
| 400 |
.ie n .IP "$undef_or_arrayref = $event\->frame" 4 |
| 401 |
.el .IP "\f(CW$undef_or_arrayref\fR = \f(CW$event\fR\->frame" 4 |
| 402 |
.IX Item "$undef_or_arrayref = $event->frame" |
| 403 |
If a trace is present, and has a caller frame, this will be an arrayref: |
| 404 |
.Sp |
| 405 |
.Vb 1 |
| 406 |
\& [$package, $file, $line, $subname] |
| 407 |
.Ve |
| 408 |
.Sp |
| 409 |
If the trace is not present, or has no caller frame this will return undef. |
| 410 |
.ie n .IP "$undef_or_string = $event\->trace_details" 4 |
| 411 |
.el .IP "\f(CW$undef_or_string\fR = \f(CW$event\fR\->trace_details" 4 |
| 412 |
.IX Item "$undef_or_string = $event->trace_details" |
| 413 |
This is usually undef, but occasionally has a string that overrides the |
| 414 |
file/line number debugging a trace usually provides on test failure. |
| 415 |
.ie n .IP "$undef_or_string = $event\->trace_package" 4 |
| 416 |
.el .IP "\f(CW$undef_or_string\fR = \f(CW$event\fR\->trace_package" 4 |
| 417 |
.IX Item "$undef_or_string = $event->trace_package" |
| 418 |
Same as \f(CW\*(C`(caller())[0]\*(C'\fR, the first element of the trace frame. |
| 419 |
.Sp |
| 420 |
Will be undef if not present. |
| 421 |
.ie n .IP "$undef_or_string = $event\->trace_file" 4 |
| 422 |
.el .IP "\f(CW$undef_or_string\fR = \f(CW$event\fR\->trace_file" 4 |
| 423 |
.IX Item "$undef_or_string = $event->trace_file" |
| 424 |
Same as \f(CW\*(C`(caller())[1]\*(C'\fR, the second element of the trace frame. |
| 425 |
.Sp |
| 426 |
Will be undef if not present. |
| 427 |
.ie n .IP "$undef_or_integer = $event\->trace_line" 4 |
| 428 |
.el .IP "\f(CW$undef_or_integer\fR = \f(CW$event\fR\->trace_line" 4 |
| 429 |
.IX Item "$undef_or_integer = $event->trace_line" |
| 430 |
Same as \f(CW\*(C`(caller())[2]\*(C'\fR, the third element of the trace frame. |
| 431 |
.Sp |
| 432 |
Will be undef if not present. |
| 433 |
.ie n .IP "$undef_or_string = $event\->trace_subname" 4 |
| 434 |
.el .IP "\f(CW$undef_or_string\fR = \f(CW$event\fR\->trace_subname" 4 |
| 435 |
.IX Item "$undef_or_string = $event->trace_subname" |
| 436 |
.PD 0 |
| 437 |
.ie n .IP "$undef_or_string = $event\->trace_tool" 4 |
| 438 |
.el .IP "\f(CW$undef_or_string\fR = \f(CW$event\fR\->trace_tool" 4 |
| 439 |
.IX Item "$undef_or_string = $event->trace_tool" |
| 440 |
.PD |
| 441 |
Aliases for the same thing |
| 442 |
.Sp |
| 443 |
Same as \f(CW\*(C`(caller($level))[4]\*(C'\fR, the fourth element of the trace frame. |
| 444 |
.Sp |
| 445 |
Will be undef if not present. |
| 446 |
.ie n .IP "$undef_or_string = $event\->trace_signature" 4 |
| 447 |
.el .IP "\f(CW$undef_or_string\fR = \f(CW$event\fR\->trace_signature" 4 |
| 448 |
.IX Item "$undef_or_string = $event->trace_signature" |
| 449 |
A string that is a unique signature for the trace. If a single context |
| 450 |
generates multiple events they will all have the same signature. This can be |
| 451 |
used to tie assertions and diagnostics sent as separate events together after |
| 452 |
the fact. |
| 453 |
.SS "ASSERT FACET" |
| 454 |
.IX Subsection "ASSERT FACET" |
| 455 |
.ie n .IP "$bool = $event\->has_assert" 4 |
| 456 |
.el .IP "\f(CW$bool\fR = \f(CW$event\fR\->has_assert" 4 |
| 457 |
.IX Item "$bool = $event->has_assert" |
| 458 |
Returns true if the event has an assert facet, false if it does not. |
| 459 |
.ie n .IP "$undef_or_hashref = $event\->the_assert" 4 |
| 460 |
.el .IP "\f(CW$undef_or_hashref\fR = \f(CW$event\fR\->the_assert" 4 |
| 461 |
.IX Item "$undef_or_hashref = $event->the_assert" |
| 462 |
Returns the assert facet if present, undef if it is not. |
| 463 |
.ie n .IP "@list_of_facets = $event\->assert" 4 |
| 464 |
.el .IP "\f(CW@list_of_facets\fR = \f(CW$event\fR\->assert" 4 |
| 465 |
.IX Item "@list_of_facets = $event->assert" |
| 466 |
TODO |
| 467 |
.ie n .IP "EMPTY_LIST_OR_STRING = $event\->assert_brief" 4 |
| 468 |
.el .IP "EMPTY_LIST_OR_STRING = \f(CW$event\fR\->assert_brief" 4 |
| 469 |
.IX Item "EMPTY_LIST_OR_STRING = $event->assert_brief" |
| 470 |
Returns a string giving a brief of the assertion if an assertion is present. |
| 471 |
Returns an empty list if no assertion is present. |
| 472 |
.SS "SUBTESTS (PARENT FACET)" |
| 473 |
.IX Subsection "SUBTESTS (PARENT FACET)" |
| 474 |
.ie n .IP "$bool = $event\->has_subtest" 4 |
| 475 |
.el .IP "\f(CW$bool\fR = \f(CW$event\fR\->has_subtest" 4 |
| 476 |
.IX Item "$bool = $event->has_subtest" |
| 477 |
True if a subetest is present in this event. |
| 478 |
.ie n .IP "$undef_or_hashref = $event\->the_subtest" 4 |
| 479 |
.el .IP "\f(CW$undef_or_hashref\fR = \f(CW$event\fR\->the_subtest" 4 |
| 480 |
.IX Item "$undef_or_hashref = $event->the_subtest" |
| 481 |
Get the one subtest if present, otherwise undef. |
| 482 |
.ie n .IP "@list_of_facets = $event\->subtest" 4 |
| 483 |
.el .IP "\f(CW@list_of_facets\fR = \f(CW$event\fR\->subtest" 4 |
| 484 |
.IX Item "@list_of_facets = $event->subtest" |
| 485 |
TODO |
| 486 |
.ie n .IP "EMPTY_LIST_OR_OBJECT = $event\->subtest_result" 4 |
| 487 |
.el .IP "EMPTY_LIST_OR_OBJECT = \f(CW$event\fR\->subtest_result" 4 |
| 488 |
.IX Item "EMPTY_LIST_OR_OBJECT = $event->subtest_result" |
| 489 |
Returns an empty list if there is no subtest. |
| 490 |
.Sp |
| 491 |
Get an instance of Test2::API::InterceptResult representing the subtest. |
| 492 |
.SS "CONTROL FACET (BAILOUT, ENCODING)" |
| 493 |
.IX Subsection "CONTROL FACET (BAILOUT, ENCODING)" |
| 494 |
.ie n .IP "$bool = $event\->has_bailout" 4 |
| 495 |
.el .IP "\f(CW$bool\fR = \f(CW$event\fR\->has_bailout" 4 |
| 496 |
.IX Item "$bool = $event->has_bailout" |
| 497 |
True if there was a bailout |
| 498 |
.ie n .IP "$undef_hashref = $event\->the_bailout" 4 |
| 499 |
.el .IP "\f(CW$undef_hashref\fR = \f(CW$event\fR\->the_bailout" 4 |
| 500 |
.IX Item "$undef_hashref = $event->the_bailout" |
| 501 |
Return the control facet if it requested a bailout. |
| 502 |
.ie n .IP "EMPTY_LIST_OR_HASHREF = $event\->bailout" 4 |
| 503 |
.el .IP "EMPTY_LIST_OR_HASHREF = \f(CW$event\fR\->bailout" 4 |
| 504 |
.IX Item "EMPTY_LIST_OR_HASHREF = $event->bailout" |
| 505 |
Get a list of 0 or 1 hashrefs. The hashref will be the control facet if a |
| 506 |
bail-out was requested. |
| 507 |
.ie n .IP "EMPTY_LIST_OR_STRING = $event\->bailout_brief" 4 |
| 508 |
.el .IP "EMPTY_LIST_OR_STRING = \f(CW$event\fR\->bailout_brief" 4 |
| 509 |
.IX Item "EMPTY_LIST_OR_STRING = $event->bailout_brief" |
| 510 |
Get the brief of the balout if present. |
| 511 |
.ie n .IP "EMPTY_LIST_OR_STRING = $event\->bailout_reason" 4 |
| 512 |
.el .IP "EMPTY_LIST_OR_STRING = \f(CW$event\fR\->bailout_reason" 4 |
| 513 |
.IX Item "EMPTY_LIST_OR_STRING = $event->bailout_reason" |
| 514 |
Get the reason for the bailout, an empty string if no reason was provided, or |
| 515 |
an empty list if there was no bailout. |
| 516 |
.SS "PLAN FACET" |
| 517 |
.IX Subsection "PLAN FACET" |
| 518 |
TODO |
| 519 |
.ie n .IP "$bool = $event\->has_plan" 4 |
| 520 |
.el .IP "\f(CW$bool\fR = \f(CW$event\fR\->has_plan" 4 |
| 521 |
.IX Item "$bool = $event->has_plan" |
| 522 |
.PD 0 |
| 523 |
.ie n .IP "$undef_or_hashref = $event\->the_plan" 4 |
| 524 |
.el .IP "\f(CW$undef_or_hashref\fR = \f(CW$event\fR\->the_plan" 4 |
| 525 |
.IX Item "$undef_or_hashref = $event->the_plan" |
| 526 |
.ie n .IP "@list_if_hashrefs = $event\->plan" 4 |
| 527 |
.el .IP "\f(CW@list_if_hashrefs\fR = \f(CW$event\fR\->plan" 4 |
| 528 |
.IX Item "@list_if_hashrefs = $event->plan" |
| 529 |
.ie n .IP "EMPTY_LIST_OR_STRING $event\->plan_brief" 4 |
| 530 |
.el .IP "EMPTY_LIST_OR_STRING \f(CW$event\fR\->plan_brief" 4 |
| 531 |
.IX Item "EMPTY_LIST_OR_STRING $event->plan_brief" |
| 532 |
.PD |
| 533 |
.SS "AMNESTY FACET (TODO AND SKIP)" |
| 534 |
.IX Subsection "AMNESTY FACET (TODO AND SKIP)" |
| 535 |
TODO |
| 536 |
.ie n .IP $event\->has_amnesty 4 |
| 537 |
.el .IP \f(CW$event\fR\->has_amnesty 4 |
| 538 |
.IX Item "$event->has_amnesty" |
| 539 |
.PD 0 |
| 540 |
.ie n .IP $event\->the_amnesty 4 |
| 541 |
.el .IP \f(CW$event\fR\->the_amnesty 4 |
| 542 |
.IX Item "$event->the_amnesty" |
| 543 |
.ie n .IP $event\->amnesty 4 |
| 544 |
.el .IP \f(CW$event\fR\->amnesty 4 |
| 545 |
.IX Item "$event->amnesty" |
| 546 |
.ie n .IP $event\->amnesty_reasons 4 |
| 547 |
.el .IP \f(CW$event\fR\->amnesty_reasons 4 |
| 548 |
.IX Item "$event->amnesty_reasons" |
| 549 |
.ie n .IP $event\->has_todos 4 |
| 550 |
.el .IP \f(CW$event\fR\->has_todos 4 |
| 551 |
.IX Item "$event->has_todos" |
| 552 |
.ie n .IP $event\->todos 4 |
| 553 |
.el .IP \f(CW$event\fR\->todos 4 |
| 554 |
.IX Item "$event->todos" |
| 555 |
.ie n .IP $event\->todo_reasons 4 |
| 556 |
.el .IP \f(CW$event\fR\->todo_reasons 4 |
| 557 |
.IX Item "$event->todo_reasons" |
| 558 |
.ie n .IP $event\->has_skips 4 |
| 559 |
.el .IP \f(CW$event\fR\->has_skips 4 |
| 560 |
.IX Item "$event->has_skips" |
| 561 |
.ie n .IP $event\->skips 4 |
| 562 |
.el .IP \f(CW$event\fR\->skips 4 |
| 563 |
.IX Item "$event->skips" |
| 564 |
.ie n .IP $event\->skip_reasons 4 |
| 565 |
.el .IP \f(CW$event\fR\->skip_reasons 4 |
| 566 |
.IX Item "$event->skip_reasons" |
| 567 |
.ie n .IP $event\->has_other_amnesty 4 |
| 568 |
.el .IP \f(CW$event\fR\->has_other_amnesty 4 |
| 569 |
.IX Item "$event->has_other_amnesty" |
| 570 |
.ie n .IP $event\->other_amnesty 4 |
| 571 |
.el .IP \f(CW$event\fR\->other_amnesty 4 |
| 572 |
.IX Item "$event->other_amnesty" |
| 573 |
.ie n .IP $event\->other_amnesty_reasons 4 |
| 574 |
.el .IP \f(CW$event\fR\->other_amnesty_reasons 4 |
| 575 |
.IX Item "$event->other_amnesty_reasons" |
| 576 |
.PD |
| 577 |
.SS "ERROR FACET (CAPTURED EXCEPTIONS)" |
| 578 |
.IX Subsection "ERROR FACET (CAPTURED EXCEPTIONS)" |
| 579 |
TODO |
| 580 |
.ie n .IP $event\->has_errors 4 |
| 581 |
.el .IP \f(CW$event\fR\->has_errors 4 |
| 582 |
.IX Item "$event->has_errors" |
| 583 |
.PD 0 |
| 584 |
.ie n .IP $event\->the_errors 4 |
| 585 |
.el .IP \f(CW$event\fR\->the_errors 4 |
| 586 |
.IX Item "$event->the_errors" |
| 587 |
.ie n .IP $event\->errors 4 |
| 588 |
.el .IP \f(CW$event\fR\->errors 4 |
| 589 |
.IX Item "$event->errors" |
| 590 |
.ie n .IP $event\->error_messages 4 |
| 591 |
.el .IP \f(CW$event\fR\->error_messages 4 |
| 592 |
.IX Item "$event->error_messages" |
| 593 |
.ie n .IP $event\->error_brief 4 |
| 594 |
.el .IP \f(CW$event\fR\->error_brief 4 |
| 595 |
.IX Item "$event->error_brief" |
| 596 |
.PD |
| 597 |
.SS "INFO FACET (DIAG, NOTE)" |
| 598 |
.IX Subsection "INFO FACET (DIAG, NOTE)" |
| 599 |
TODO |
| 600 |
.ie n .IP $event\->has_info 4 |
| 601 |
.el .IP \f(CW$event\fR\->has_info 4 |
| 602 |
.IX Item "$event->has_info" |
| 603 |
.PD 0 |
| 604 |
.ie n .IP $event\->the_info 4 |
| 605 |
.el .IP \f(CW$event\fR\->the_info 4 |
| 606 |
.IX Item "$event->the_info" |
| 607 |
.ie n .IP $event\->info 4 |
| 608 |
.el .IP \f(CW$event\fR\->info 4 |
| 609 |
.IX Item "$event->info" |
| 610 |
.ie n .IP $event\->info_messages 4 |
| 611 |
.el .IP \f(CW$event\fR\->info_messages 4 |
| 612 |
.IX Item "$event->info_messages" |
| 613 |
.ie n .IP $event\->has_diags 4 |
| 614 |
.el .IP \f(CW$event\fR\->has_diags 4 |
| 615 |
.IX Item "$event->has_diags" |
| 616 |
.ie n .IP $event\->diags 4 |
| 617 |
.el .IP \f(CW$event\fR\->diags 4 |
| 618 |
.IX Item "$event->diags" |
| 619 |
.ie n .IP $event\->diag_messages 4 |
| 620 |
.el .IP \f(CW$event\fR\->diag_messages 4 |
| 621 |
.IX Item "$event->diag_messages" |
| 622 |
.ie n .IP $event\->has_notes 4 |
| 623 |
.el .IP \f(CW$event\fR\->has_notes 4 |
| 624 |
.IX Item "$event->has_notes" |
| 625 |
.ie n .IP $event\->notes 4 |
| 626 |
.el .IP \f(CW$event\fR\->notes 4 |
| 627 |
.IX Item "$event->notes" |
| 628 |
.ie n .IP $event\->note_messages 4 |
| 629 |
.el .IP \f(CW$event\fR\->note_messages 4 |
| 630 |
.IX Item "$event->note_messages" |
| 631 |
.ie n .IP $event\->has_other_info 4 |
| 632 |
.el .IP \f(CW$event\fR\->has_other_info 4 |
| 633 |
.IX Item "$event->has_other_info" |
| 634 |
.ie n .IP $event\->other_info 4 |
| 635 |
.el .IP \f(CW$event\fR\->other_info 4 |
| 636 |
.IX Item "$event->other_info" |
| 637 |
.ie n .IP $event\->other_info_messages 4 |
| 638 |
.el .IP \f(CW$event\fR\->other_info_messages 4 |
| 639 |
.IX Item "$event->other_info_messages" |
| 640 |
.PD |
| 641 |
.SH SOURCE |
| 642 |
.IX Header "SOURCE" |
| 643 |
The source code repository for Test2 can be found at |
| 644 |
<https://github.com/Test\-More/test\-more/>. |
| 645 |
.SH MAINTAINERS |
| 646 |
.IX Header "MAINTAINERS" |
| 647 |
.IP "Chad Granum <[email protected]>" 4 |
| 648 |
.IX Item "Chad Granum <[email protected]>" |
| 649 |
.SH AUTHORS |
| 650 |
.IX Header "AUTHORS" |
| 651 |
.PD 0 |
| 652 |
.IP "Chad Granum <[email protected]>" 4 |
| 653 |
.IX Item "Chad Granum <[email protected]>" |
| 654 |
.PD |
| 655 |
.SH COPYRIGHT |
| 656 |
.IX Header "COPYRIGHT" |
| 657 |
Copyright 2020 Chad Granum <[email protected]>. |
| 658 |
.PP |
| 659 |
This program is free software; you can redistribute it and/or |
| 660 |
modify it under the same terms as Perl itself. |
| 661 |
.PP |
| 662 |
See <https://dev.perl.org/licenses/> |