summaryrefslogtreecommitdiff
path: root/Master/tlpkg/tlperl/lib/Test2/EventFacet
diff options
context:
space:
mode:
Diffstat (limited to 'Master/tlpkg/tlperl/lib/Test2/EventFacet')
-rw-r--r--Master/tlpkg/tlperl/lib/Test2/EventFacet/About.pm12
-rw-r--r--Master/tlpkg/tlperl/lib/Test2/EventFacet/Amnesty.pm4
-rw-r--r--Master/tlpkg/tlperl/lib/Test2/EventFacet/Assert.pm4
-rw-r--r--Master/tlpkg/tlperl/lib/Test2/EventFacet/Control.pm4
-rw-r--r--Master/tlpkg/tlperl/lib/Test2/EventFacet/Error.pm4
-rw-r--r--Master/tlpkg/tlperl/lib/Test2/EventFacet/Hub.pm6
-rw-r--r--Master/tlpkg/tlperl/lib/Test2/EventFacet/Info.pm36
-rwxr-xr-xMaster/tlpkg/tlperl/lib/Test2/EventFacet/Info/Table.pm142
-rw-r--r--Master/tlpkg/tlperl/lib/Test2/EventFacet/Meta.pm4
-rw-r--r--Master/tlpkg/tlperl/lib/Test2/EventFacet/Parent.pm6
-rw-r--r--Master/tlpkg/tlperl/lib/Test2/EventFacet/Plan.pm4
-rw-r--r--Master/tlpkg/tlperl/lib/Test2/EventFacet/Render.pm6
-rw-r--r--Master/tlpkg/tlperl/lib/Test2/EventFacet/Trace.pm19
13 files changed, 214 insertions, 37 deletions
diff --git a/Master/tlpkg/tlperl/lib/Test2/EventFacet/About.pm b/Master/tlpkg/tlperl/lib/Test2/EventFacet/About.pm
index fe1d30eca05..fc36d2766a8 100644
--- a/Master/tlpkg/tlperl/lib/Test2/EventFacet/About.pm
+++ b/Master/tlpkg/tlperl/lib/Test2/EventFacet/About.pm
@@ -2,10 +2,10 @@ package Test2::EventFacet::About;
use strict;
use warnings;
-our $VERSION = '1.302133';
+our $VERSION = '1.302162';
BEGIN { require Test2::EventFacet; our @ISA = qw(Test2::EventFacet) }
-use Test2::Util::HashBase qw{ -package -no_display -uuid };
+use Test2::Util::HashBase qw{ -package -no_display -uuid -eid };
1;
@@ -51,6 +51,12 @@ True if the event should be skipped by formatters.
Will be set to a uuid if uuid tagging was enabled.
+=item $uuid = $about->{eid}
+
+=item $uuid = $about->eid()
+
+A unique (for the test job) identifier for the event.
+
=back
=head1 SOURCE
@@ -76,7 +82,7 @@ F<http://github.com/Test-More/test-more/>.
=head1 COPYRIGHT
-Copyright 2018 Chad Granum E<lt>exodist@cpan.orgE<gt>.
+Copyright 2019 Chad Granum E<lt>exodist@cpan.orgE<gt>.
This program is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.
diff --git a/Master/tlpkg/tlperl/lib/Test2/EventFacet/Amnesty.pm b/Master/tlpkg/tlperl/lib/Test2/EventFacet/Amnesty.pm
index 9ef227f1669..ac72cf3890c 100644
--- a/Master/tlpkg/tlperl/lib/Test2/EventFacet/Amnesty.pm
+++ b/Master/tlpkg/tlperl/lib/Test2/EventFacet/Amnesty.pm
@@ -2,7 +2,7 @@ package Test2::EventFacet::Amnesty;
use strict;
use warnings;
-our $VERSION = '1.302133';
+our $VERSION = '1.302162';
sub is_list { 1 }
@@ -81,7 +81,7 @@ F<http://github.com/Test-More/test-more/>.
=head1 COPYRIGHT
-Copyright 2018 Chad Granum E<lt>exodist@cpan.orgE<gt>.
+Copyright 2019 Chad Granum E<lt>exodist@cpan.orgE<gt>.
This program is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.
diff --git a/Master/tlpkg/tlperl/lib/Test2/EventFacet/Assert.pm b/Master/tlpkg/tlperl/lib/Test2/EventFacet/Assert.pm
index 090860aa0bb..a11aef15691 100644
--- a/Master/tlpkg/tlperl/lib/Test2/EventFacet/Assert.pm
+++ b/Master/tlpkg/tlperl/lib/Test2/EventFacet/Assert.pm
@@ -2,7 +2,7 @@ package Test2::EventFacet::Assert;
use strict;
use warnings;
-our $VERSION = '1.302133';
+our $VERSION = '1.302162';
BEGIN { require Test2::EventFacet; our @ISA = qw(Test2::EventFacet) }
use Test2::Util::HashBase qw{ -pass -no_debug -number };
@@ -83,7 +83,7 @@ F<http://github.com/Test-More/test-more/>.
=head1 COPYRIGHT
-Copyright 2018 Chad Granum E<lt>exodist@cpan.orgE<gt>.
+Copyright 2019 Chad Granum E<lt>exodist@cpan.orgE<gt>.
This program is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.
diff --git a/Master/tlpkg/tlperl/lib/Test2/EventFacet/Control.pm b/Master/tlpkg/tlperl/lib/Test2/EventFacet/Control.pm
index b52718df557..6ea0eaef404 100644
--- a/Master/tlpkg/tlperl/lib/Test2/EventFacet/Control.pm
+++ b/Master/tlpkg/tlperl/lib/Test2/EventFacet/Control.pm
@@ -2,7 +2,7 @@ package Test2::EventFacet::Control;
use strict;
use warnings;
-our $VERSION = '1.302133';
+our $VERSION = '1.302162';
BEGIN { require Test2::EventFacet; our @ISA = qw(Test2::EventFacet) }
use Test2::Util::HashBase qw{ -global -terminate -halt -has_callback -encoding };
@@ -90,7 +90,7 @@ F<http://github.com/Test-More/test-more/>.
=head1 COPYRIGHT
-Copyright 2018 Chad Granum E<lt>exodist@cpan.orgE<gt>.
+Copyright 2019 Chad Granum E<lt>exodist@cpan.orgE<gt>.
This program is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.
diff --git a/Master/tlpkg/tlperl/lib/Test2/EventFacet/Error.pm b/Master/tlpkg/tlperl/lib/Test2/EventFacet/Error.pm
index 306dc310d88..4a21ef7e286 100644
--- a/Master/tlpkg/tlperl/lib/Test2/EventFacet/Error.pm
+++ b/Master/tlpkg/tlperl/lib/Test2/EventFacet/Error.pm
@@ -2,7 +2,7 @@ package Test2::EventFacet::Error;
use strict;
use warnings;
-our $VERSION = '1.302133';
+our $VERSION = '1.302162';
sub facet_key { 'errors' }
sub is_list { 1 }
@@ -83,7 +83,7 @@ F<http://github.com/Test-More/test-more/>.
=head1 COPYRIGHT
-Copyright 2018 Chad Granum E<lt>exodist@cpan.orgE<gt>.
+Copyright 2019 Chad Granum E<lt>exodist@cpan.orgE<gt>.
This program is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.
diff --git a/Master/tlpkg/tlperl/lib/Test2/EventFacet/Hub.pm b/Master/tlpkg/tlperl/lib/Test2/EventFacet/Hub.pm
index 03c55530544..40b9d658026 100644
--- a/Master/tlpkg/tlperl/lib/Test2/EventFacet/Hub.pm
+++ b/Master/tlpkg/tlperl/lib/Test2/EventFacet/Hub.pm
@@ -2,7 +2,7 @@ package Test2::EventFacet::Hub;
use strict;
use warnings;
-our $VERSION = '1.302133';
+our $VERSION = '1.302162';
sub is_list { 1 }
sub facet_key { 'hubs' }
@@ -20,7 +20,7 @@ __END__
=head1 NAME
-Test2::EventFacet::Hub
+Test2::EventFacet::Hub - Facet for the hubs an event passes through.
=head1 DESCRIPTION
@@ -99,7 +99,7 @@ F<http://github.com/Test-More/test-more/>.
=head1 COPYRIGHT
-Copyright 2018 Chad Granum E<lt>exodist@cpan.orgE<gt>.
+Copyright 2019 Chad Granum E<lt>exodist@cpan.orgE<gt>.
This program is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.
diff --git a/Master/tlpkg/tlperl/lib/Test2/EventFacet/Info.pm b/Master/tlpkg/tlperl/lib/Test2/EventFacet/Info.pm
index 805cab1ba97..c382049480d 100644
--- a/Master/tlpkg/tlperl/lib/Test2/EventFacet/Info.pm
+++ b/Master/tlpkg/tlperl/lib/Test2/EventFacet/Info.pm
@@ -2,12 +2,12 @@ package Test2::EventFacet::Info;
use strict;
use warnings;
-our $VERSION = '1.302133';
+our $VERSION = '1.302162';
sub is_list { 1 }
BEGIN { require Test2::EventFacet; our @ISA = qw(Test2::EventFacet) }
-use Test2::Util::HashBase qw{-tag -debug -important};
+use Test2::Util::HashBase qw{-tag -debug -important -table};
1;
@@ -42,6 +42,36 @@ Human readable string or data structure, this is the information to display.
Formatters are free to render the structures however they please. This may
contain a blessed object.
+If the C<table> attribute (see below) is set then a renderer may choose to
+display the table instead of the details.
+
+=item $structure = $info->{table}
+
+=item $structure = $info->table()
+
+If the data the C<info> facet needs to convey can be represented as a table
+then the data may be placed in this attribute in a more raw form for better
+display. The data must also be represented in the C<details> attribute for
+renderers which do not support rendering tables directly.
+
+The table structure:
+
+ my %table = {
+ header => [ 'column 1 header', 'column 2 header', ... ], # Optional
+
+ rows => [
+ ['row 1 column 1', 'row 1, column 2', ... ],
+ ['row 2 column 1', 'row 2, column 2', ... ],
+ ...
+ ],
+
+ # Allow the renderer to hide empty columns when true, Optional
+ collapse => $BOOL,
+
+ # List by name or number columns that should never be collapsed
+ no_collapse => \@LIST,
+ }
+
=item $short_string = $info->{tag}
=item $short_string = $info->tag()
@@ -92,7 +122,7 @@ F<http://github.com/Test-More/test-more/>.
=head1 COPYRIGHT
-Copyright 2018 Chad Granum E<lt>exodist@cpan.orgE<gt>.
+Copyright 2019 Chad Granum E<lt>exodist@cpan.orgE<gt>.
This program is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.
diff --git a/Master/tlpkg/tlperl/lib/Test2/EventFacet/Info/Table.pm b/Master/tlpkg/tlperl/lib/Test2/EventFacet/Info/Table.pm
new file mode 100755
index 00000000000..64bd95539a5
--- /dev/null
+++ b/Master/tlpkg/tlperl/lib/Test2/EventFacet/Info/Table.pm
@@ -0,0 +1,142 @@
+package Test2::EventFacet::Info::Table;
+use strict;
+use warnings;
+
+use Carp qw/confess/;
+
+use Test2::Util::HashBase qw{-header -rows -collapse -no_collapse -as_string};
+
+sub init {
+ my $self = shift;
+
+ confess "Table may not be empty" unless ref($self->{+ROWS}) eq 'ARRAY' && @{$self->{+ROWS}};
+
+ $self->{+AS_STRING} ||= '<TABLE NOT DISPLAYED>';
+}
+
+sub as_hash { my $out = +{%{$_[0]}}; delete $out->{as_string}; $out }
+
+sub info_args {
+ my $self = shift;
+
+ my $hash = $self->as_hash;
+ my $desc = $self->as_string;
+
+ return (table => $hash, details => $desc);
+}
+
+1;
+
+__END__
+
+=pod
+
+=encoding UTF-8
+
+=head1 NAME
+
+Test2::EventFacet::Info::Table - Intermediary representation of a table.
+
+=head1 DESCRIPTION
+
+Intermediary representation of a table for use in specialized
+L<Test::API::Context> methods which generate L<Test2::EventFacet::Info> facets.
+
+=head1 SYNOPSIS
+
+ 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();
+
+=head1 ATTRIBUTES
+
+=over 4
+
+=item $header_aref = $t->header()
+
+=item $rows_aref = $t->rows()
+
+=item $bool = $t->collapse()
+
+=item $aref = $t->no_collapse()
+
+The above are all directly tied to the table hashref structure described in
+L<Test2::EventFacet::Info>.
+
+=item $str = $t->as_string()
+
+This returns the string form of the table if it was set, otherwise it returns
+the string C<< "<TABLE NOT DISPLAYED>" >>.
+
+=item $href = $t->as_hash()
+
+This returns the data structure used for tables by L<Test2::EventFacet::Info>.
+
+=item %args = $t->info_args()
+
+This returns the arguments that should be used to construct the proper
+L<Test2::EventFacet::Info> structure.
+
+ return (table => $t->as_hash(), details => $t->as_string());
+
+=back
+
+=head1 SOURCE
+
+The source code repository for Test2 can be found at
+F<http://github.com/Test-More/test-more/>.
+
+=head1 MAINTAINERS
+
+=over 4
+
+=item Chad Granum E<lt>exodist@cpan.orgE<gt>
+
+=back
+
+=head1 AUTHORS
+
+=over 4
+
+=item Chad Granum E<lt>exodist@cpan.orgE<gt>
+
+=back
+
+=head1 COPYRIGHT
+
+Copyright 2019 Chad Granum E<lt>exodist@cpan.orgE<gt>.
+
+This program is free software; you can redistribute it and/or
+modify it under the same terms as Perl itself.
+
+See F<http://dev.perl.org/licenses/>
+
+=cut
diff --git a/Master/tlpkg/tlperl/lib/Test2/EventFacet/Meta.pm b/Master/tlpkg/tlperl/lib/Test2/EventFacet/Meta.pm
index 31a4e0c1f8d..dc369ff2b1c 100644
--- a/Master/tlpkg/tlperl/lib/Test2/EventFacet/Meta.pm
+++ b/Master/tlpkg/tlperl/lib/Test2/EventFacet/Meta.pm
@@ -2,7 +2,7 @@ package Test2::EventFacet::Meta;
use strict;
use warnings;
-our $VERSION = '1.302133';
+our $VERSION = '1.302162';
BEGIN { require Test2::EventFacet; our @ISA = qw(Test2::EventFacet) }
use vars qw/$AUTOLOAD/;
@@ -94,7 +94,7 @@ F<http://github.com/Test-More/test-more/>.
=head1 COPYRIGHT
-Copyright 2018 Chad Granum E<lt>exodist@cpan.orgE<gt>.
+Copyright 2019 Chad Granum E<lt>exodist@cpan.orgE<gt>.
This program is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.
diff --git a/Master/tlpkg/tlperl/lib/Test2/EventFacet/Parent.pm b/Master/tlpkg/tlperl/lib/Test2/EventFacet/Parent.pm
index baf66e99a67..d36fd92b27c 100644
--- a/Master/tlpkg/tlperl/lib/Test2/EventFacet/Parent.pm
+++ b/Master/tlpkg/tlperl/lib/Test2/EventFacet/Parent.pm
@@ -2,7 +2,7 @@ package Test2::EventFacet::Parent;
use strict;
use warnings;
-our $VERSION = '1.302133';
+our $VERSION = '1.302162';
use Carp qw/confess/;
@@ -26,7 +26,7 @@ __END__
=head1 NAME
-Test2::EventFacet::Parent - Base class for all event facets.
+Test2::EventFacet::Parent - Facet for events contains other events
=head1 DESCRIPTION
@@ -88,7 +88,7 @@ F<http://github.com/Test-More/test-more/>.
=head1 COPYRIGHT
-Copyright 2018 Chad Granum E<lt>exodist@cpan.orgE<gt>.
+Copyright 2019 Chad Granum E<lt>exodist@cpan.orgE<gt>.
This program is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.
diff --git a/Master/tlpkg/tlperl/lib/Test2/EventFacet/Plan.pm b/Master/tlpkg/tlperl/lib/Test2/EventFacet/Plan.pm
index 3789bcb5c91..2f14f7d69e0 100644
--- a/Master/tlpkg/tlperl/lib/Test2/EventFacet/Plan.pm
+++ b/Master/tlpkg/tlperl/lib/Test2/EventFacet/Plan.pm
@@ -2,7 +2,7 @@ package Test2::EventFacet::Plan;
use strict;
use warnings;
-our $VERSION = '1.302133';
+our $VERSION = '1.302162';
BEGIN { require Test2::EventFacet; our @ISA = qw(Test2::EventFacet) }
use Test2::Util::HashBase qw{ -count -skip -none };
@@ -84,7 +84,7 @@ F<http://github.com/Test-More/test-more/>.
=head1 COPYRIGHT
-Copyright 2018 Chad Granum E<lt>exodist@cpan.orgE<gt>.
+Copyright 2019 Chad Granum E<lt>exodist@cpan.orgE<gt>.
This program is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.
diff --git a/Master/tlpkg/tlperl/lib/Test2/EventFacet/Render.pm b/Master/tlpkg/tlperl/lib/Test2/EventFacet/Render.pm
index 709a9f61823..07c454365a2 100644
--- a/Master/tlpkg/tlperl/lib/Test2/EventFacet/Render.pm
+++ b/Master/tlpkg/tlperl/lib/Test2/EventFacet/Render.pm
@@ -2,7 +2,7 @@ package Test2::EventFacet::Render;
use strict;
use warnings;
-our $VERSION = '1.302133';
+our $VERSION = '1.302162';
sub is_list { 1 }
@@ -53,7 +53,7 @@ Tag that should prefix/identify the main text.
Optional, if the display text was generated from another facet this should
state what facet it was.
-=item $mode = $render->[#]->mode{}
+=item $mode = $render->[#]->{mode}
=item $mode = $render->[#]->mode()
@@ -96,7 +96,7 @@ F<http://github.com/Test-More/test-more/>.
=head1 COPYRIGHT
-Copyright 2018 Chad Granum E<lt>exodist@cpan.orgE<gt>.
+Copyright 2019 Chad Granum E<lt>exodist@cpan.orgE<gt>.
This program is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.
diff --git a/Master/tlpkg/tlperl/lib/Test2/EventFacet/Trace.pm b/Master/tlpkg/tlperl/lib/Test2/EventFacet/Trace.pm
index 280258c6aa5..34a3fce7ad0 100644
--- a/Master/tlpkg/tlperl/lib/Test2/EventFacet/Trace.pm
+++ b/Master/tlpkg/tlperl/lib/Test2/EventFacet/Trace.pm
@@ -2,11 +2,11 @@ package Test2::EventFacet::Trace;
use strict;
use warnings;
-our $VERSION = '1.302133';
+our $VERSION = '1.302162';
BEGIN { require Test2::EventFacet; our @ISA = qw(Test2::EventFacet) }
-use Test2::Util qw/get_tid pkg_to_file/;
+use Test2::Util qw/get_tid pkg_to_file gen_uid/;
use Carp qw/confess/;
use Test2::Util::HashBase qw{^frame ^pid ^tid ^cid -hid -nested details -buffered -uuid -huuid};
@@ -24,8 +24,10 @@ sub init {
$_[0]->{+DETAILS} = delete $_[0]->{detail} if $_[0]->{detail};
- $_[0]->{+PID} = $$ unless defined $_[0]->{+PID};
- $_[0]->{+TID} = get_tid() unless defined $_[0]->{+TID};
+ unless (defined($_[0]->{+PID}) || defined($_[0]->{+TID}) || defined($_[0]->{+CID})) {
+ $_[0]->{+PID} = $$ unless defined $_[0]->{+PID};
+ $_[0]->{+TID} = get_tid() unless defined $_[0]->{+TID};
+ }
}
sub snapshot {
@@ -239,11 +241,8 @@ Get the debug-info subroutine name.
=item $sig = trace->signature
Get a signature string that identifies this trace. This is used to check if
-multiple events are related.
-
-If UUID's are enabled then a uuid is returned. Otherwise the signature includes
-pid, tid, file, line number, and the cid which is C<'C\d+'> for traces created
-by a context, or C<'T\d+'> for traces created by C<new()>.
+multiple events are related. The signature includes pid, tid, file, line
+number, and the cid.
=back
@@ -270,7 +269,7 @@ F<http://github.com/Test-More/test-more/>.
=head1 COPYRIGHT
-Copyright 2018 Chad Granum E<lt>exodist@cpan.orgE<gt>.
+Copyright 2019 Chad Granum E<lt>exodist@cpan.orgE<gt>.
This program is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.