1Test2::EventFacet::InfoU:s:eTrabCloen(t3r)ibuted Perl DoTceusmte2n:t:aEtvieonntFacet::Info::Table(3)
2
3
4
6 Test2::EventFacet::Info::Table - Intermediary representation of a
7 table.
8
10 Intermediary representation of a table for use in specialized
11 Test::API::Context methods which generate Test2::EventFacet::Info
12 facets.
13
15 use Test2::EventFacet::Info::Table;
16 use Test2::API qw/context/;
17
18 sub my_tool {
19 my $ctx = context();
20
21 ...
22
23 $ctx->fail(
24 $name,
25 "failure diag message",
26 Test2::EventFacet::Info::Table->new(
27 # Required
28 rows => [['a', 'b'], ['c', 'd'], ...],
29
30 # Strongly Recommended
31 as_string => "... string to print when table cannot be rendered ...",
32
33 # Optional
34 header => ['col1', 'col2'],
35 collapse => $bool,
36 no_collapse => ['col1', ...],
37 ),
38 );
39
40 ...
41
42 $ctx->release;
43 }
44
45 my_tool();
46
48 $header_aref = $t->header()
49 $rows_aref = $t->rows()
50 $bool = $t->collapse()
51 $aref = $t->no_collapse()
52 The above are all directly tied to the table hashref structure
53 described in Test2::EventFacet::Info.
54
55 $str = $t->as_string()
56 This returns the string form of the table if it was set, otherwise
57 it returns the string "<TABLE NOT DISPLAYED>".
58
59 $href = $t->as_hash()
60 This returns the data structure used for tables by
61 Test2::EventFacet::Info.
62
63 %args = $t->info_args()
64 This returns the arguments that should be used to construct the
65 proper Test2::EventFacet::Info structure.
66
67 return (table => $t->as_hash(), details => $t->as_string());
68
70 The source code repository for Test2 can be found at
71 http://github.com/Test-More/test-more/.
72
74 Chad Granum <exodist@cpan.org>
75
77 Chad Granum <exodist@cpan.org>
78
80 Copyright 2020 Chad Granum <exodist@cpan.org>.
81
82 This program is free software; you can redistribute it and/or modify it
83 under the same terms as Perl itself.
84
85 See http://dev.perl.org/licenses/
86
87
88
89perl v5.38.0 2023-07-21 Test2::EventFacet::Info::Table(3)