Test2::EventFacet::Info::Table - 表格的中介表示。
表格的中介表示,用於產生 Test2::EventFacet::Info 面向的特殊 Test::API::Context 方法。
use Test2::EventFacet::Info::Table;
use Test2::API qw/context/;
sub my_tool {
my $ctx = context();
...
$ctx->fail(
$name,
"failure diag message",
Test2::EventFacet::Info::Table->new(
# Required
rows => [['a', 'b'], ['c', 'd'], ...],
# Strongly Recommended
as_string => "... string to print when table cannot be rendered ...",
# Optional
header => ['col1', 'col2'],
collapse => $bool,
no_collapse => ['col1', ...],
),
);
...
$ctx->release;
}
my_tool();
以上皆直接連結到 Test2::EventFacet::Info 中描述的表格雜湊結構。
如果已設定,此函式會傳回表格的字串形式,否則會傳回字串 "<TABLE NOT DISPLAYED>"
。
此函式會傳回 Test2::EventFacet::Info 用於表格的資料結構。
此函式會傳回用於建構適當 Test2::EventFacet::Info 結構的引數。
return (table => $t->as_hash(), details => $t->as_string());
Test2 的原始碼存放庫位於 http://github.com/Test-More/test-more/。
Copyright 2020 Chad Granum <exodist@cpan.org>。
此程式為自由軟體;您可以在與 Perl 相同的條款下重新散布或修改它。
請參閱 http://dev.perl.org/licenses/