Skip to content

Commit

Permalink
Remove Info event
Browse files Browse the repository at this point in the history
This was never properly conceptualized or used.

Fixes #755
  • Loading branch information
exodist committed Apr 4, 2017
1 parent 82cc7da commit 65d3c0b
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 217 deletions.
25 changes: 3 additions & 22 deletions lib/Test2/API/Context.pm
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ my %LOADED = (
my $file = "Test2/Event/$_.pm";
require $file unless $INC{$file};
( $pkg => $pkg, $_ => $pkg )
} qw/Ok Diag Note Info Plan Bail Exception Waiting Skip Subtest/
} qw/Ok Diag Note Plan Bail Exception Waiting Skip Subtest/
);

use Test2::Util::ExternalMeta qw/meta get_meta set_meta delete_meta/;
Expand Down Expand Up @@ -250,14 +250,7 @@ sub ok {
$self->failure_diag($e);

if ($on_fail && @$on_fail) {
for my $of (@$on_fail) {
if (ref($of) eq 'CODE' || (blessed($of) && $of->can('render'))) {
$self->info($of, diagnostics => 1);
}
else {
$self->diag($of);
}
}
$self->diag($_) for @$on_fail;
}

return $e;
Expand Down Expand Up @@ -295,12 +288,6 @@ sub skip {
);
}

sub info {
my $self = shift;
my ($renderer, %params) = @_;
$self->send_event('Info', renderer => $renderer, %params);
}

sub note {
my $self = shift;
my ($message) = @_;
Expand Down Expand Up @@ -558,13 +545,7 @@ failure. If you do not want automatic diagnostics you should use the
C<send_event()> method directly.
The third argument C<\@on_fail>) is an optional set of diagnostics to be sent in
the event of a test failure. Plain strings will be sent as
L<Test2::Event::Diag> events. References will be used to construct
L<Test2::Event::Info> events with C<< diagnostics => 1 >>.
=item $event = $ctx->info($renderer, diagnostics => $bool, %other_params)
Send an L<Test2::Event::Info>.
the event of a test failure.
=item $event = $ctx->note($message)
Expand Down
127 changes: 0 additions & 127 deletions lib/Test2/Event/Info.pm

This file was deleted.

19 changes: 2 additions & 17 deletions t/Test2/modules/API/Context.t
Original file line number Diff line number Diff line change
Expand Up @@ -336,15 +336,10 @@ sub {
}->();

{
{
package An::Info::Thingy;
sub render { 'zzz' }
}

my ($e1, $e2);
my $events = intercept {
my $ctx = context();
$e1 = $ctx->ok(0, 'foo', ['xxx', sub { 'yyy' }, bless({}, 'An::Info::Thingy')]);
$e1 = $ctx->ok(0, 'foo', ['xxx']);
$e2 = $ctx->ok(0, 'foo');
$ctx->release;
};
Expand All @@ -353,19 +348,9 @@ sub {
ok($e2->isa('Test2::Event::Ok'), "returned ok event");

is($events->[0], $e1, "got ok event 1");
is($events->[3], $e2, "got ok event 2");

is($events->[2]->message, 'xxx', "event 1 diag 2");
ok($events->[2]->isa('Test2::Event::Diag'), "event 1 diag 2 is diag");

is($events->[3]->summary, 'yyy', "event 1 info 1");
is($events->[3]->diagnostics, 1, "event 1 info 1 is diagnostics");
ok($events->[3]->isa('Test2::Event::Info'), "event 1 info 1 is an info");

is($events->[4]->summary, 'zzz', "event 1 info 2");
is($events->[4]->diagnostics, 1, "event 1 info 2 is diagnostics");
ok($events->[4]->isa('Test2::Event::Info'), "event 2 info 1 is an info");

is($events->[5], $e2, "got ok event 2");
}

sub {
Expand Down
51 changes: 0 additions & 51 deletions t/Test2/modules/Event/Info.t

This file was deleted.

0 comments on commit 65d3c0b

Please sign in to comment.