1Test2::Formatter::Test2U:s:eCromCpoonsterri(b3u)ted PerlTeDsotc2u:m:eFnotramtaitotner::Test2::Composer(3)
2
3
4

NAME

6       Test2::Formatter::Test2::Composer - Compose output components from
7       event facets
8

DESCRIPTION

10       This is used by Test2::Formatter::Test2 to turn events into output
11       components. This logic lives here instead of in the formatter because
12       it is also used by Test2::Harness::UI. Other tools may also find this
13       conversion useful.
14

SYNOPSIS

16           use Test2::Formatter::Test2::Composer;
17
18           # Note, all methods are class methods, this is just here for convenience.
19           my $comp = Test2::Formatter::Test2::Composer->new();
20
21           my $out = $comp->render_one_line($event);
22           my ($facet_name, $tag_string, $text_for_humans) = @$out;
23           ...
24
25           for my $line ($comp->render_verbose($event)) {
26               my ($facet_name, $tag_string, $text_for_humans) = @$line;
27               ...,
28           }
29

METHODS

31       All methods are class methods, but they also work just fine on a
32       blessed instance. There is no benefit to a blessed instance, but you
33       can create one for convenience if it makes you more comfortable.
34
35       $inst = $class->new()
36           Create a blessed instance. This is here for convenience only. All
37           methods are class methods.
38
39       $arrayref = $class->render_one_line($event)
40       $arrayref = $class->render_one_line(\%facet_data)
41               my $out = $comp->render_one_line($event);
42               my ($facet_name, $tag_string, $text_for_humans) = @$out;
43
44           This will return a single line of output from the event, even if
45           the event would normally return multiple lines.
46
47           In order of priority:
48
49           Custom 'render' facet
50           Control 'halt' facet (bail-out)
51           Assertion (pass/fail)
52           Error message
53           Plan
54           Info (note/diag)
55           Timing data
56           About
57       @lines = $class->render_verbose($event, %control_params)
58       @lines = $class->render_verbose(\%facet_data, %control_params)
59           This will verbosely render any event. The %control_params are
60           passed directly to "render_control()" and are not used for anything
61           else.
62
63               for my $line ($comp->render_verbose($event)) {
64                   my ($facet_name, $tag_string, $text_for_humans) = @$line;
65                   ...,
66               }
67
68       @lines = $class->render_super_verbose($event)
69       @lines = $class->render_super_verbose(\%facet_data)
70           This is even more verbose than "render_verbose()" because it
71           produces output lines even for facets that should normally not be
72           seen, things that would usually be considered noise.
73
74           This is mainly useful for tools that allow deep inspection of log
75           files.
76
77   FACET RENDERERS
78       With exception of "render_control()" these are all the same. These all
79       take "\%facet_data" as their only argument, and return a list of line-
80       arrayrefs "[$facet, $tag, $text_for_humans]".
81
82       @lines = $class->render_control(\%facet_data, super_verbose => $bool)
83           This specific one is special in that it can take an extra argument.
84           This argument is used to toggle between super_verbose and regular
85           verbosity. No other facet renderer needs this toggle. If omitted it
86           defaults to not being super verbose.
87
88       @lines = $class->render_launch(\%facet_data)
89       @lines = $class->render_start(\%facet_data)
90       @lines = $class->render_exit(\%facet_data)
91       @lines = $class->render_end(\%facet_data)
92       @lines = $class->render_brief(\%facet_data)
93       @lines = $class->render_plan(\%facet_data)
94       @lines = $class->render_assert(\%facet_data)
95       @lines = $class->render_amnesty(\%facet_data)
96       @lines = $class->render_debug(\%facet_data)
97       @lines = $class->render_info(\%facet_data)
98       @lines = $class->render_about(\%facet_data)
99       @lines = $class->render_errors(\%facet_data)
100

SOURCE

102       The source code repository for Test2-Harness can be found at
103       http://github.com/Test-More/Test2-Harness/.
104

MAINTAINERS

106       Chad Granum <exodist@cpan.org>
107

AUTHORS

109       Chad Granum <exodist@cpan.org>
110
112       Copyright 2020 Chad Granum <exodist7@gmail.com>.
113
114       This program is free software; you can redistribute it and/or modify it
115       under the same terms as Perl itself.
116
117       See http://dev.perl.org/licenses/
118
119
120
121perl v5.32.0                      2020-07-2T8est2::Formatter::Test2::Composer(3)
Impressum