Skip to content

Commit

Permalink
Make ctx->send_event detect termination events
Browse files Browse the repository at this point in the history
Fixes #707
  • Loading branch information
exodist committed Aug 18, 2016
1 parent 3ec926b commit 7d5bee6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
1 change: 1 addition & 0 deletions Changes
Expand Up @@ -5,6 +5,7 @@
- Document Test::Builder::Tester plan limitations
- Document limitations in is_deeply (#595)
- Better documentation of done_testing purpose (#151)
- Make ctx->send_event detect termination events (#707)

1.302052 2016-08-13 14:34:07-07:00 America/Los_Angeles

Expand Down
13 changes: 6 additions & 7 deletions lib/Test2/API/Context.pm
Expand Up @@ -201,12 +201,13 @@ sub send_event {

my $pkg = $LOADED{$event} || $self->_parse_event($event);

$self->{+HUB}->send(
$pkg->new(
trace => $self->{+TRACE}->snapshot,
%args,
)
my $e = $pkg->new(
trace => $self->{+TRACE}->snapshot,
%args,
);

${$self->{+_ABORTED}}++ if $self->{+_ABORTED} && defined $e->terminate;
$self->{+HUB}->send($e);
}

sub build_event {
Expand Down Expand Up @@ -317,13 +318,11 @@ sub diag {

sub plan {
my ($self, $max, $directive, $reason) = @_;
${$self->{+_ABORTED}}++ if $self->{+_ABORTED} && $directive && $directive =~ m/^(SKIP|skip_all)$/;
$self->send_event('Plan', max => $max, directive => $directive, reason => $reason);
}

sub bail {
my ($self, $reason) = @_;
${$self->{+_ABORTED}}++ if $self->{+_ABORTED};
$self->send_event('Bail', reason => $reason);
}

Expand Down

0 comments on commit 7d5bee6

Please sign in to comment.