summaryrefslogtreecommitdiff
path: root/cpan/Test-Simple
diff options
context:
space:
mode:
authorSteve Hay <steve.m.hay@googlemail.com>2016-09-14 14:08:37 +0100
committerSteve Hay <steve.m.hay@googlemail.com>2016-09-14 14:08:37 +0100
commit7aa7bbc77f31758cee033ea8f91ea509a4aff7f5 (patch)
tree73c8b239e5aab8dfe82fbb5ef858e7af933f2c97 /cpan/Test-Simple
parent6ad15231b493b02c8de67d569c41b9403c64c934 (diff)
downloadperl-7aa7bbc77f31758cee033ea8f91ea509a4aff7f5.tar.gz
Upgrade Test::Simple from version 1.302052 to 1.302056
Diffstat (limited to 'cpan/Test-Simple')
-rw-r--r--cpan/Test-Simple/lib/Test/Builder.pm9
-rw-r--r--cpan/Test-Simple/lib/Test/Builder/Formatter.pm12
-rw-r--r--cpan/Test-Simple/lib/Test/Builder/Module.pm2
-rw-r--r--cpan/Test-Simple/lib/Test/Builder/Tester.pm10
-rw-r--r--cpan/Test-Simple/lib/Test/Builder/Tester/Color.pm2
-rw-r--r--cpan/Test-Simple/lib/Test/Builder/TodoDiag.pm2
-rw-r--r--cpan/Test-Simple/lib/Test/More.pm22
-rw-r--r--cpan/Test-Simple/lib/Test/Simple.pm2
-rw-r--r--cpan/Test-Simple/lib/Test/Tester.pm2
-rw-r--r--cpan/Test-Simple/lib/Test/Tester/Capture.pm2
-rw-r--r--cpan/Test-Simple/lib/Test/Tester/CaptureRunner.pm2
-rw-r--r--cpan/Test-Simple/lib/Test/Tester/Delegate.pm2
-rw-r--r--cpan/Test-Simple/lib/Test/use/ok.pm2
-rw-r--r--cpan/Test-Simple/lib/Test2.pm52
-rw-r--r--cpan/Test-Simple/lib/Test2/API.pm17
-rw-r--r--cpan/Test-Simple/lib/Test2/API/Breakage.pm2
-rw-r--r--cpan/Test-Simple/lib/Test2/API/Context.pm15
-rw-r--r--cpan/Test-Simple/lib/Test2/API/Instance.pm2
-rw-r--r--cpan/Test-Simple/lib/Test2/API/Stack.pm2
-rw-r--r--cpan/Test-Simple/lib/Test2/Event.pm2
-rw-r--r--cpan/Test-Simple/lib/Test2/Event/Bail.pm2
-rw-r--r--cpan/Test-Simple/lib/Test2/Event/Diag.pm2
-rw-r--r--cpan/Test-Simple/lib/Test2/Event/Exception.pm2
-rw-r--r--cpan/Test-Simple/lib/Test2/Event/Generic.pm2
-rw-r--r--cpan/Test-Simple/lib/Test2/Event/Info.pm2
-rw-r--r--cpan/Test-Simple/lib/Test2/Event/Note.pm2
-rw-r--r--cpan/Test-Simple/lib/Test2/Event/Ok.pm6
-rw-r--r--cpan/Test-Simple/lib/Test2/Event/Plan.pm2
-rw-r--r--cpan/Test-Simple/lib/Test2/Event/Skip.pm2
-rw-r--r--cpan/Test-Simple/lib/Test2/Event/Subtest.pm2
-rw-r--r--cpan/Test-Simple/lib/Test2/Event/Waiting.pm2
-rw-r--r--cpan/Test-Simple/lib/Test2/Formatter.pm2
-rw-r--r--cpan/Test-Simple/lib/Test2/Formatter/TAP.pm26
-rw-r--r--cpan/Test-Simple/lib/Test2/Hub.pm2
-rw-r--r--cpan/Test-Simple/lib/Test2/Hub/Interceptor.pm12
-rw-r--r--cpan/Test-Simple/lib/Test2/Hub/Interceptor/Terminator.pm2
-rw-r--r--cpan/Test-Simple/lib/Test2/Hub/Subtest.pm2
-rw-r--r--cpan/Test-Simple/lib/Test2/IPC.pm2
-rw-r--r--cpan/Test-Simple/lib/Test2/IPC/Driver.pm2
-rw-r--r--cpan/Test-Simple/lib/Test2/IPC/Driver/Files.pm2
-rw-r--r--cpan/Test-Simple/lib/Test2/Util.pm2
-rw-r--r--cpan/Test-Simple/lib/Test2/Util/ExternalMeta.pm2
-rw-r--r--cpan/Test-Simple/lib/Test2/Util/HashBase.pm2
-rw-r--r--cpan/Test-Simple/lib/Test2/Util/Trace.pm2
-rw-r--r--cpan/Test-Simple/lib/ok.pm2
-rw-r--r--cpan/Test-Simple/t/Test2/behavior/special_names.t118
-rw-r--r--cpan/Test-Simple/t/Test2/legacy/TAP.t7
-rw-r--r--cpan/Test-Simple/t/Test2/modules/Event/Ok.t12
-rw-r--r--cpan/Test-Simple/t/Test2/modules/Formatter/TAP.t70
-rw-r--r--cpan/Test-Simple/t/Test2/modules/Hub/Interceptor.t2
-rw-r--r--cpan/Test-Simple/t/lib/SkipAll.pm7
-rw-r--r--cpan/Test-Simple/t/regression/696-intercept_skip_all.t41
52 files changed, 419 insertions, 89 deletions
diff --git a/cpan/Test-Simple/lib/Test/Builder.pm b/cpan/Test-Simple/lib/Test/Builder.pm
index 14804195a2..f0e7598747 100644
--- a/cpan/Test-Simple/lib/Test/Builder.pm
+++ b/cpan/Test-Simple/lib/Test/Builder.pm
@@ -4,7 +4,7 @@ use 5.006;
use strict;
use warnings;
-our $VERSION = '1.302052';
+our $VERSION = '1.302056';
BEGIN {
if( $] < 5.008 ) {
@@ -624,13 +624,6 @@ sub ok {
my $orig_name = $name;
- # The regex form is ~250ms, the index form is ~50ms
- #$name && $name =~ m/(?:#|\n)/ && ($name =~ s|#|\\#|g, $name =~ s{\n}{\n# }sg);
- $name && (
- (index($name, "#" ) >= 0 && $name =~ s|#|\\#|g),
- (index($name, "\n") >= 0 && $name =~ s{\n}{\n# }sg)
- );
-
my @attrs;
my $subevents = delete $self->{subevents};
my $subtest_id = delete $self->{subtest_id};
diff --git a/cpan/Test-Simple/lib/Test/Builder/Formatter.pm b/cpan/Test-Simple/lib/Test/Builder/Formatter.pm
index 24e8daf9b2..83ee55ff5c 100644
--- a/cpan/Test-Simple/lib/Test/Builder/Formatter.pm
+++ b/cpan/Test-Simple/lib/Test/Builder/Formatter.pm
@@ -2,7 +2,7 @@ package Test::Builder::Formatter;
use strict;
use warnings;
-our $VERSION = '1.302052';
+our $VERSION = '1.302056';
BEGIN { require Test2::Formatter::TAP; our @ISA = qw(Test2::Formatter::TAP) }
@@ -43,6 +43,16 @@ sub event_plan {
return $self->SUPER::event_plan(@_);
}
+sub event_ok_multiline {
+ my $self = shift;
+ my ($out, $space, @extra) = @_;
+
+ return(
+ [OUT_STD, "$out\n"],
+ map {[OUT_STD, "# $_\n"]} @extra,
+ );
+}
+
1;
__END__
diff --git a/cpan/Test-Simple/lib/Test/Builder/Module.pm b/cpan/Test-Simple/lib/Test/Builder/Module.pm
index f46a7b4d4c..354ff5886f 100644
--- a/cpan/Test-Simple/lib/Test/Builder/Module.pm
+++ b/cpan/Test-Simple/lib/Test/Builder/Module.pm
@@ -7,7 +7,7 @@ use Test::Builder;
require Exporter;
our @ISA = qw(Exporter);
-our $VERSION = '1.302052';
+our $VERSION = '1.302056';
=head1 NAME
diff --git a/cpan/Test-Simple/lib/Test/Builder/Tester.pm b/cpan/Test-Simple/lib/Test/Builder/Tester.pm
index 4622d5f71b..c4ea80c75b 100644
--- a/cpan/Test-Simple/lib/Test/Builder/Tester.pm
+++ b/cpan/Test-Simple/lib/Test/Builder/Tester.pm
@@ -1,7 +1,7 @@
package Test::Builder::Tester;
use strict;
-our $VERSION = '1.302052';
+our $VERSION = '1.302056';
use Test::Builder;
use Symbol;
@@ -436,6 +436,14 @@ sub color {
=head1 BUGS
+Test::Builder::Tester does not handle plans well. It has never done anything
+special with plans. This means that plans from outside Test::Builder::Tester
+will effect Test::Builder::Tester, worse plans when using Test::Builder::Tester
+will effect overall testing. At this point there are no plans to fix this bug
+as people have come to depend on it, and Test::Builder::Tester is now
+discouraged in favor of C<Test2::API::intercept()>. See
+L<https://github.com/Test-More/test-more/issues/667>
+
Calls C<< Test::Builder->no_ending >> turning off the ending tests.
This is needed as otherwise it will trip out because we've run more
tests than we strictly should have and it'll register any failures we
diff --git a/cpan/Test-Simple/lib/Test/Builder/Tester/Color.pm b/cpan/Test-Simple/lib/Test/Builder/Tester/Color.pm
index 3f151ff51b..a83edca68f 100644
--- a/cpan/Test-Simple/lib/Test/Builder/Tester/Color.pm
+++ b/cpan/Test-Simple/lib/Test/Builder/Tester/Color.pm
@@ -1,7 +1,7 @@
package Test::Builder::Tester::Color;
use strict;
-our $VERSION = '1.302052';
+our $VERSION = '1.302056';
require Test::Builder::Tester;
diff --git a/cpan/Test-Simple/lib/Test/Builder/TodoDiag.pm b/cpan/Test-Simple/lib/Test/Builder/TodoDiag.pm
index 4f7c85986d..632e3fad20 100644
--- a/cpan/Test-Simple/lib/Test/Builder/TodoDiag.pm
+++ b/cpan/Test-Simple/lib/Test/Builder/TodoDiag.pm
@@ -2,7 +2,7 @@ package Test::Builder::TodoDiag;
use strict;
use warnings;
-our $VERSION = '1.302052';
+our $VERSION = '1.302056';
BEGIN { require Test2::Event::Diag; our @ISA = qw(Test2::Event::Diag) }
diff --git a/cpan/Test-Simple/lib/Test/More.pm b/cpan/Test-Simple/lib/Test/More.pm
index 2051993095..3705a916bd 100644
--- a/cpan/Test-Simple/lib/Test/More.pm
+++ b/cpan/Test-Simple/lib/Test/More.pm
@@ -17,7 +17,7 @@ sub _carp {
return warn @_, " at $file line $line\n";
}
-our $VERSION = '1.302052';
+our $VERSION = '1.302056';
use Test::Builder::Module;
our @ISA = qw(Test::Builder::Module);
@@ -125,6 +125,8 @@ the end.
done_testing( $number_of_tests_run );
+B<NOTE> C<done_testing()> should never be called in an C<END { ... }> block.
+
Sometimes you really don't know how many tests were run, or it's too
difficult to calculate. In which case you can leave off
$number_of_tests_run.
@@ -232,6 +234,10 @@ conclusion.
This is safer than and replaces the "no_plan" plan.
+B<Note:> You must never put C<done_testing()> inside an C<END { ... }> block.
+The plan is there to ensure your test does not exit before testing has
+completed. If you use an END block you completely bypass this protection.
+
=back
=cut
@@ -1064,6 +1070,20 @@ improve in the future.
L<Test::Differences> and L<Test::Deep> provide more in-depth functionality
along these lines.
+B<NOTE> is_deeply() has limitations when it comes to comparing strings and
+refs:
+
+ my $path = path('.');
+ my $hash = {};
+ is_deeply( $path, "$path" ); # ok
+ is_deeply( $hash, "$hash" ); # fail
+
+This happens because is_deeply will unoverload all arguments unconditionally.
+It is probably best not to use is_deeply with overloading. For legacy reasons
+this is not likely to ever be fixed. If you would like a much better tool for
+this you should see L<Test2::Suite> Specifically L<Test2::Tools::Compare> has
+an C<is()> function that works like C<is_deeply> with many improvements.
+
=cut
our( @Data_Stack, %Refs_Seen );
diff --git a/cpan/Test-Simple/lib/Test/Simple.pm b/cpan/Test-Simple/lib/Test/Simple.pm
index 54f51a04e9..3ff4c227e5 100644
--- a/cpan/Test-Simple/lib/Test/Simple.pm
+++ b/cpan/Test-Simple/lib/Test/Simple.pm
@@ -4,7 +4,7 @@ use 5.006;
use strict;
-our $VERSION = '1.302052';
+our $VERSION = '1.302056';
use Test::Builder::Module;
our @ISA = qw(Test::Builder::Module);
diff --git a/cpan/Test-Simple/lib/Test/Tester.pm b/cpan/Test-Simple/lib/Test/Tester.pm
index 7efacdf3a3..68780b741e 100644
--- a/cpan/Test-Simple/lib/Test/Tester.pm
+++ b/cpan/Test-Simple/lib/Test/Tester.pm
@@ -18,7 +18,7 @@ require Exporter;
use vars qw( @ISA @EXPORT );
-our $VERSION = '1.302052';
+our $VERSION = '1.302056';
@EXPORT = qw( run_tests check_tests check_test cmp_results show_space );
@ISA = qw( Exporter );
diff --git a/cpan/Test-Simple/lib/Test/Tester/Capture.pm b/cpan/Test-Simple/lib/Test/Tester/Capture.pm
index abba76af86..6a169d6c2f 100644
--- a/cpan/Test-Simple/lib/Test/Tester/Capture.pm
+++ b/cpan/Test-Simple/lib/Test/Tester/Capture.pm
@@ -2,7 +2,7 @@ use strict;
package Test::Tester::Capture;
-our $VERSION = '1.302052';
+our $VERSION = '1.302056';
use Test::Builder;
diff --git a/cpan/Test-Simple/lib/Test/Tester/CaptureRunner.pm b/cpan/Test-Simple/lib/Test/Tester/CaptureRunner.pm
index 23c65850a5..22eace0f13 100644
--- a/cpan/Test-Simple/lib/Test/Tester/CaptureRunner.pm
+++ b/cpan/Test-Simple/lib/Test/Tester/CaptureRunner.pm
@@ -3,7 +3,7 @@ use strict;
package Test::Tester::CaptureRunner;
-our $VERSION = '1.302052';
+our $VERSION = '1.302056';
use Test::Tester::Capture;
diff --git a/cpan/Test-Simple/lib/Test/Tester/Delegate.pm b/cpan/Test-Simple/lib/Test/Tester/Delegate.pm
index 86f9ac4516..13b798b673 100644
--- a/cpan/Test-Simple/lib/Test/Tester/Delegate.pm
+++ b/cpan/Test-Simple/lib/Test/Tester/Delegate.pm
@@ -3,7 +3,7 @@ use warnings;
package Test::Tester::Delegate;
-our $VERSION = '1.302052';
+our $VERSION = '1.302056';
use vars '$AUTOLOAD';
diff --git a/cpan/Test-Simple/lib/Test/use/ok.pm b/cpan/Test-Simple/lib/Test/use/ok.pm
index 52194bc982..dd5fcef9f4 100644
--- a/cpan/Test-Simple/lib/Test/use/ok.pm
+++ b/cpan/Test-Simple/lib/Test/use/ok.pm
@@ -1,7 +1,7 @@
package Test::use::ok;
use 5.005;
-our $VERSION = '1.302052';
+our $VERSION = '1.302056';
__END__
diff --git a/cpan/Test-Simple/lib/Test2.pm b/cpan/Test-Simple/lib/Test2.pm
index e6c46bc6da..85a1ee318e 100644
--- a/cpan/Test-Simple/lib/Test2.pm
+++ b/cpan/Test-Simple/lib/Test2.pm
@@ -2,7 +2,7 @@ package Test2;
use strict;
use warnings;
-our $VERSION = '1.302052';
+our $VERSION = '1.302056';
1;
@@ -22,10 +22,58 @@ Test2 - Framework for writing test tools that all work together.
Test2 is a new testing framework produced by forking L<Test::Builder>,
completely refactoring it, adding many new features and capabilities.
+=head2 WHAT IS NEW?
+
+=over 4
+
+=item Easier to test new testing tools.
+
+From the beginning Test2 was built with introspection capabilities. With
+Test::Builder it was difficult at best to capture test tool output for
+verification. Test2 Makes it easy with C<Test2::API::intercept()>.
+
+=item Better diagnostics capabilities.
+
+Test2 uses an L<Test2::API::Context> object to track filename, line number, and
+tool details. This object greatly simplifies tracking for where errors should
+be reported.
+
+=item Event driven.
+
+Test2 based tools produce events which get passed through a processing system
+before being output by a formatter. This event system allows for rich plugin
+and extension support.
+
+=item More complete API.
+
+Test::Builder only provided a handful of methods for generating lines of TAP.
+Test2 took inventory of everything people were doing with Test::Builder that
+required hacking it up. Test2 made public API functions for nearly all the
+desired functionality people didn't previously have.
+
+=item Support for output other than TAP.
+
+Test::Builder assumed everything would end up as TAP. Test2 makes no such
+assumption. Test2 provides ways for you to specify alternative and custom
+formatters.
+
+=item Subtest implementation is more sane.
+
+The Test::Builder implementation of subtests was certifiably insane. Test2 uses
+a stacked event hub system that greatly improves how subtests are implemented.
+
+=item Support for threading/forking.
+
+Test2 support for forking and threading can be turned on using L<Test2::IPC>.
+Once turned on threading and forking operate sanely and work as one would
+expect.
+
+=back
+
=head1 GETTING STARTED
If you are interested in writing tests using new tools then you should look at
-L<Test2::Suite>. L<Test::Suite> is a separate cpan distribution that contains
+L<Test2::Suite>. L<Test2::Suite> is a separate cpan distribution that contains
many tools implemented on Test2.
If you are interested in writing new tools you should take a look at
diff --git a/cpan/Test-Simple/lib/Test2/API.pm b/cpan/Test-Simple/lib/Test2/API.pm
index 23a62da3b2..118d7e623e 100644
--- a/cpan/Test-Simple/lib/Test2/API.pm
+++ b/cpan/Test-Simple/lib/Test2/API.pm
@@ -2,7 +2,7 @@ package Test2::API;
use strict;
use warnings;
-our $VERSION = '1.302052';
+our $VERSION = '1.302056';
my $INST;
@@ -389,11 +389,17 @@ sub intercept(&) {
$ctx->stack->top; # Make sure there is a top hub before we begin.
$ctx->stack->push($hub);
- # Do not use 'try' cause it localizes __DIE__
- my ($ok, $err);
- {
+ my ($ok, $err) = (1, undef);
+ T2_SUBTEST_WRAPPER: {
+ # Do not use 'try' cause it localizes __DIE__
$ok = eval { $code->(hub => $hub, context => $ctx->snapshot); 1 };
$err = $@;
+
+ # They might have done 'BEGIN { skip_all => "whatever" }'
+ if (!$ok && $err =~ m/Label not found for "last T2_SUBTEST_WRAPPER"/ || (blessed($err) && $err->isa('Test2::Hub::Interceptor::Terminator'))) {
+ $ok = 1;
+ $err = undef;
+ }
}
$hub->cull;
@@ -402,8 +408,7 @@ sub intercept(&) {
my $trace = $ctx->trace;
$ctx->release;
- die $err unless $ok
- || (blessed($err) && $err->isa('Test2::Hub::Interceptor::Terminator'));
+ die $err unless $ok;
$hub->finalize($trace, 1)
if $ok
diff --git a/cpan/Test-Simple/lib/Test2/API/Breakage.pm b/cpan/Test-Simple/lib/Test2/API/Breakage.pm
index ba633d5052..0569bc9448 100644
--- a/cpan/Test-Simple/lib/Test2/API/Breakage.pm
+++ b/cpan/Test-Simple/lib/Test2/API/Breakage.pm
@@ -2,7 +2,7 @@ package Test2::API::Breakage;
use strict;
use warnings;
-our $VERSION = '1.302052';
+our $VERSION = '1.302056';
use Test2::Util qw/pkg_to_file/;
diff --git a/cpan/Test-Simple/lib/Test2/API/Context.pm b/cpan/Test-Simple/lib/Test2/API/Context.pm
index a9f217cd7f..a83560e0b6 100644
--- a/cpan/Test-Simple/lib/Test2/API/Context.pm
+++ b/cpan/Test-Simple/lib/Test2/API/Context.pm
@@ -2,7 +2,7 @@ package Test2::API::Context;
use strict;
use warnings;
-our $VERSION = '1.302052';
+our $VERSION = '1.302056';
use Carp qw/confess croak longmess/;
@@ -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 {
@@ -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);
}
diff --git a/cpan/Test-Simple/lib/Test2/API/Instance.pm b/cpan/Test-Simple/lib/Test2/API/Instance.pm
index 4bf239610e..1b41c66acb 100644
--- a/cpan/Test-Simple/lib/Test2/API/Instance.pm
+++ b/cpan/Test-Simple/lib/Test2/API/Instance.pm
@@ -2,7 +2,7 @@ package Test2::API::Instance;
use strict;
use warnings;
-our $VERSION = '1.302052';
+our $VERSION = '1.302056';
our @CARP_NOT = qw/Test2::API Test2::API::Instance Test2::IPC::Driver Test2::Formatter/;
diff --git a/cpan/Test-Simple/lib/Test2/API/Stack.pm b/cpan/Test-Simple/lib/Test2/API/Stack.pm
index a24a2a6e61..89fe2ebe1b 100644
--- a/cpan/Test-Simple/lib/Test2/API/Stack.pm
+++ b/cpan/Test-Simple/lib/Test2/API/Stack.pm
@@ -2,7 +2,7 @@ package Test2::API::Stack;
use strict;
use warnings;
-our $VERSION = '1.302052';
+our $VERSION = '1.302056';
use Test2::Hub();
diff --git a/cpan/Test-Simple/lib/Test2/Event.pm b/cpan/Test-Simple/lib/Test2/Event.pm
index 0d588027ba..5f3427be09 100644
--- a/cpan/Test-Simple/lib/Test2/Event.pm
+++ b/cpan/Test-Simple/lib/Test2/Event.pm
@@ -2,7 +2,7 @@ package Test2::Event;
use strict;
use warnings;
-our $VERSION = '1.302052';
+our $VERSION = '1.302056';
use Test2::Util::HashBase qw/trace nested in_subtest subtest_id/;
diff --git a/cpan/Test-Simple/lib/Test2/Event/Bail.pm b/cpan/Test-Simple/lib/Test2/Event/Bail.pm
index 47ce30916c..9523a785a3 100644
--- a/cpan/Test-Simple/lib/Test2/Event/Bail.pm
+++ b/cpan/Test-Simple/lib/Test2/Event/Bail.pm
@@ -2,7 +2,7 @@ package Test2::Event::Bail;
use strict;
use warnings;
-our $VERSION = '1.302052';
+our $VERSION = '1.302056';
BEGIN { require Test2::Event; our @ISA = qw(Test2::Event) }
diff --git a/cpan/Test-Simple/lib/Test2/Event/Diag.pm b/cpan/Test-Simple/lib/Test2/Event/Diag.pm
index df5b702ac4..a1339a4e44 100644
--- a/cpan/Test-Simple/lib/Test2/Event/Diag.pm
+++ b/cpan/Test-Simple/lib/Test2/Event/Diag.pm
@@ -2,7 +2,7 @@ package Test2::Event::Diag;
use strict;
use warnings;
-our $VERSION = '1.302052';
+our $VERSION = '1.302056';
BEGIN { require Test2::Event; our @ISA = qw(Test2::Event) }
diff --git a/cpan/Test-Simple/lib/Test2/Event/Exception.pm b/cpan/Test-Simple/lib/Test2/Event/Exception.pm
index a1e9e093cf..3e3b020567 100644
--- a/cpan/Test-Simple/lib/Test2/Event/Exception.pm
+++ b/cpan/Test-Simple/lib/Test2/Event/Exception.pm
@@ -2,7 +2,7 @@ package Test2::Event::Exception;
use strict;
use warnings;
-our $VERSION = '1.302052';
+our $VERSION = '1.302056';
BEGIN { require Test2::Event; our @ISA = qw(Test2::Event) }
diff --git a/cpan/Test-Simple/lib/Test2/Event/Generic.pm b/cpan/Test-Simple/lib/Test2/Event/Generic.pm
index d7b7a0c45d..64187f4d18 100644
--- a/cpan/Test-Simple/lib/Test2/Event/Generic.pm
+++ b/cpan/Test-Simple/lib/Test2/Event/Generic.pm
@@ -5,7 +5,7 @@ use warnings;
use Carp qw/croak/;
use Scalar::Util qw/reftype/;
-our $VERSION = '1.302052';
+our $VERSION = '1.302056';
BEGIN { require Test2::Event; our @ISA = qw(Test2::Event) }
use Test2::Util::HashBase;
diff --git a/cpan/Test-Simple/lib/Test2/Event/Info.pm b/cpan/Test-Simple/lib/Test2/Event/Info.pm
index 481f2eb8ce..6446b38a6b 100644
--- a/cpan/Test-Simple/lib/Test2/Event/Info.pm
+++ b/cpan/Test-Simple/lib/Test2/Event/Info.pm
@@ -4,7 +4,7 @@ use warnings;
use Scalar::Util qw/blessed/;
-our $VERSION = '1.302052';
+our $VERSION = '1.302056';
BEGIN { require Test2::Event; our @ISA = qw(Test2::Event) }
use Test2::Util::HashBase qw/diagnostics renderer/;
diff --git a/cpan/Test-Simple/lib/Test2/Event/Note.pm b/cpan/Test-Simple/lib/Test2/Event/Note.pm
index 9f7ad73c67..03f5bd0c8d 100644
--- a/cpan/Test-Simple/lib/Test2/Event/Note.pm
+++ b/cpan/Test-Simple/lib/Test2/Event/Note.pm
@@ -2,7 +2,7 @@ package Test2::Event::Note;
use strict;
use warnings;
-our $VERSION = '1.302052';
+our $VERSION = '1.302056';
BEGIN { require Test2::Event; our @ISA = qw(Test2::Event) }
diff --git a/cpan/Test-Simple/lib/Test2/Event/Ok.pm b/cpan/Test-Simple/lib/Test2/Event/Ok.pm
index c9a43e7bf8..b9dab95775 100644
--- a/cpan/Test-Simple/lib/Test2/Event/Ok.pm
+++ b/cpan/Test-Simple/lib/Test2/Event/Ok.pm
@@ -2,7 +2,7 @@ package Test2::Event::Ok;
use strict;
use warnings;
-our $VERSION = '1.302052';
+our $VERSION = '1.302056';
BEGIN { require Test2::Event; our @ISA = qw(Test2::Event) }
@@ -16,10 +16,6 @@ sub init {
# Do not store objects here, only true or false
$self->{+PASS} = $self->{+PASS} ? 1 : 0;
$self->{+EFFECTIVE_PASS} = $self->{+PASS} || (defined($self->{+TODO}) ? 1 : 0);
-
- my $name = $self->{+NAME} or return;
- return unless index($name, '#') != -1 || index($name, "\n") != -1;
- $self->trace->throw("'$name' is not a valid name, names must not contain '#' or newlines.")
}
{
diff --git a/cpan/Test-Simple/lib/Test2/Event/Plan.pm b/cpan/Test-Simple/lib/Test2/Event/Plan.pm
index 63b222b03a..b6b3ea9e5e 100644
--- a/cpan/Test-Simple/lib/Test2/Event/Plan.pm
+++ b/cpan/Test-Simple/lib/Test2/Event/Plan.pm
@@ -2,7 +2,7 @@ package Test2::Event::Plan;
use strict;
use warnings;
-our $VERSION = '1.302052';
+our $VERSION = '1.302056';
BEGIN { require Test2::Event; our @ISA = qw(Test2::Event) }
diff --git a/cpan/Test-Simple/lib/Test2/Event/Skip.pm b/cpan/Test-Simple/lib/Test2/Event/Skip.pm
index 0dd5037688..a54ddf6cd0 100644
--- a/cpan/Test-Simple/lib/Test2/Event/Skip.pm
+++ b/cpan/Test-Simple/lib/Test2/Event/Skip.pm
@@ -2,7 +2,7 @@ package Test2::Event::Skip;
use strict;
use warnings;
-our $VERSION = '1.302052';
+our $VERSION = '1.302056';
BEGIN { require Test2::Event::Ok; our @ISA = qw(Test2::Event::Ok) }
diff --git a/cpan/Test-Simple/lib/Test2/Event/Subtest.pm b/cpan/Test-Simple/lib/Test2/Event/Subtest.pm
index f28bb2f83d..00a07c1337 100644
--- a/cpan/Test-Simple/lib/Test2/Event/Subtest.pm
+++ b/cpan/Test-Simple/lib/Test2/Event/Subtest.pm
@@ -2,7 +2,7 @@ package Test2::Event::Subtest;
use strict;
use warnings;
-our $VERSION = '1.302052';
+our $VERSION = '1.302056';
BEGIN { require Test2::Event::Ok; our @ISA = qw(Test2::Event::Ok) }
diff --git a/cpan/Test-Simple/lib/Test2/Event/Waiting.pm b/cpan/Test-Simple/lib/Test2/Event/Waiting.pm
index 12774166e9..694e741ebe 100644
--- a/cpan/Test-Simple/lib/Test2/Event/Waiting.pm
+++ b/cpan/Test-Simple/lib/Test2/Event/Waiting.pm
@@ -2,7 +2,7 @@ package Test2::Event::Waiting;
use strict;
use warnings;
-our $VERSION = '1.302052';
+our $VERSION = '1.302056';
BEGIN { require Test2::Event; our @ISA = qw(Test2::Event) }
diff --git a/cpan/Test-Simple/lib/Test2/Formatter.pm b/cpan/Test-Simple/lib/Test2/Formatter.pm
index aa667edc7e..9d0cc1a5ac 100644
--- a/cpan/Test-Simple/lib/Test2/Formatter.pm
+++ b/cpan/Test-Simple/lib/Test2/Formatter.pm
@@ -2,7 +2,7 @@ package Test2::Formatter;
use strict;
use warnings;
-our $VERSION = '1.302052';
+our $VERSION = '1.302056';
my %ADDED;
diff --git a/cpan/Test-Simple/lib/Test2/Formatter/TAP.pm b/cpan/Test-Simple/lib/Test2/Formatter/TAP.pm
index 642821ebdb..d69f7676ba 100644
--- a/cpan/Test-Simple/lib/Test2/Formatter/TAP.pm
+++ b/cpan/Test-Simple/lib/Test2/Formatter/TAP.pm
@@ -3,7 +3,7 @@ use strict;
use warnings;
require PerlIO;
-our $VERSION = '1.302052';
+our $VERSION = '1.302056';
use Test2::Util::HashBase qw{
@@ -154,12 +154,34 @@ sub event_ok {
$out .= "not " unless $e->{pass};
$out .= "ok";
$out .= " $num" if defined($num);
+
+ # The regex form is ~250ms, the index form is ~50ms
+ my @extra;
+ defined($name) && (
+ (index($name, "\n") != -1 && (($name, @extra) = split(/\n\r?/, $name, -1))),
+ ((index($name, "#" ) != -1 || substr($name, -1) eq '\\') && (($name =~ s|\\|\\\\|g), ($name =~ s|#|\\#|g)))
+ );
+
+ my $space = @extra ? ' ' x (length($out) + 2) : '';
+
$out .= " - $name" if defined $name;
$out .= " # TODO" if $in_todo;
$out .= " $todo" if defined($todo) && length($todo);
# The primary line of TAP, if the test passed this is all we need.
- return([OUT_STD, "$out\n"]);
+ return([OUT_STD, "$out\n"]) unless @extra;
+
+ return $self->event_ok_multiline($out, $space, @extra);
+}
+
+sub event_ok_multiline {
+ my $self = shift;
+ my ($out, $space, @extra) = @_;
+
+ return(
+ [OUT_STD, "$out\n"],
+ map {[OUT_STD, "#${space}$_\n"]} @extra,
+ );
}
sub event_skip {
diff --git a/cpan/Test-Simple/lib/Test2/Hub.pm b/cpan/Test-Simple/lib/Test2/Hub.pm
index c68f15fad1..1c6433336b 100644
--- a/cpan/Test-Simple/lib/Test2/Hub.pm
+++ b/cpan/Test-Simple/lib/Test2/Hub.pm
@@ -2,7 +2,7 @@ package Test2::Hub;
use strict;
use warnings;
-our $VERSION = '1.302052';
+our $VERSION = '1.302056';
use Carp qw/carp croak confess/;
diff --git a/cpan/Test-Simple/lib/Test2/Hub/Interceptor.pm b/cpan/Test-Simple/lib/Test2/Hub/Interceptor.pm
index 2a6e47501a..9ed129bab7 100644
--- a/cpan/Test-Simple/lib/Test2/Hub/Interceptor.pm
+++ b/cpan/Test-Simple/lib/Test2/Hub/Interceptor.pm
@@ -2,7 +2,7 @@ package Test2::Hub::Interceptor;
use strict;
use warnings;
-our $VERSION = '1.302052';
+our $VERSION = '1.302056';
use Test2::Hub::Interceptor::Terminator();
@@ -24,7 +24,15 @@ sub inherit {
sub terminate {
my $self = shift;
my ($code) = @_;
- die bless(\$code, 'Test2::Hub::Interceptor::Terminator');
+
+ eval {
+ no warnings 'exiting';
+ last T2_SUBTEST_WRAPPER;
+ };
+ my $err = $@;
+
+ # Fallback
+ die bless(\$err, 'Test2::Hub::Interceptor::Terminator');
}
1;
diff --git a/cpan/Test-Simple/lib/Test2/Hub/Interceptor/Terminator.pm b/cpan/Test-Simple/lib/Test2/Hub/Interceptor/Terminator.pm
index 1cedfaeb31..83dd0a9df0 100644
--- a/cpan/Test-Simple/lib/Test2/Hub/Interceptor/Terminator.pm
+++ b/cpan/Test-Simple/lib/Test2/Hub/Interceptor/Terminator.pm
@@ -2,7 +2,7 @@ package Test2::Hub::Interceptor::Terminator;
use strict;
use warnings;
-our $VERSION = '1.302052';
+our $VERSION = '1.302056';
1;
diff --git a/cpan/Test-Simple/lib/Test2/Hub/Subtest.pm b/cpan/Test-Simple/lib/Test2/Hub/Subtest.pm
index 5a84e82396..5cbafb8366 100644
--- a/cpan/Test-Simple/lib/Test2/Hub/Subtest.pm
+++ b/cpan/Test-Simple/lib/Test2/Hub/Subtest.pm
@@ -2,7 +2,7 @@ package Test2::Hub::Subtest;
use strict;
use warnings;
-our $VERSION = '1.302052';
+our $VERSION = '1.302056';
BEGIN { require Test2::Hub; our @ISA = qw(Test2::Hub) }
diff --git a/cpan/Test-Simple/lib/Test2/IPC.pm b/cpan/Test-Simple/lib/Test2/IPC.pm
index 7e5af9cc01..d8d04f31c2 100644
--- a/cpan/Test-Simple/lib/Test2/IPC.pm
+++ b/cpan/Test-Simple/lib/Test2/IPC.pm
@@ -2,7 +2,7 @@ package Test2::IPC;
use strict;
use warnings;
-our $VERSION = '1.302052';
+our $VERSION = '1.302056';
use Test2::API::Instance;
diff --git a/cpan/Test-Simple/lib/Test2/IPC/Driver.pm b/cpan/Test-Simple/lib/Test2/IPC/Driver.pm
index e889cd97ce..68b65befcf 100644
--- a/cpan/Test-Simple/lib/Test2/IPC/Driver.pm
+++ b/cpan/Test-Simple/lib/Test2/IPC/Driver.pm
@@ -2,7 +2,7 @@ package Test2::IPC::Driver;
use strict;
use warnings;
-our $VERSION = '1.302052';
+our $VERSION = '1.302056';
use Carp qw/confess longmess/;
diff --git a/cpan/Test-Simple/lib/Test2/IPC/Driver/Files.pm b/cpan/Test-Simple/lib/Test2/IPC/Driver/Files.pm
index 344e9e4d7a..ad6a0c2565 100644
--- a/cpan/Test-Simple/lib/Test2/IPC/Driver/Files.pm
+++ b/cpan/Test-Simple/lib/Test2/IPC/Driver/Files.pm
@@ -2,7 +2,7 @@ package Test2::IPC::Driver::Files;
use strict;
use warnings;
-our $VERSION = '1.302052';
+our $VERSION = '1.302056';
BEGIN { require Test2::IPC::Driver; our @ISA = qw(Test2::IPC::Driver) }
diff --git a/cpan/Test-Simple/lib/Test2/Util.pm b/cpan/Test-Simple/lib/Test2/Util.pm
index 268a4b0104..436d8b844b 100644
--- a/cpan/Test-Simple/lib/Test2/Util.pm
+++ b/cpan/Test-Simple/lib/Test2/Util.pm
@@ -2,7 +2,7 @@ package Test2::Util;
use strict;
use warnings;
-our $VERSION = '1.302052';
+our $VERSION = '1.302056';
use Config qw/%Config/;
diff --git a/cpan/Test-Simple/lib/Test2/Util/ExternalMeta.pm b/cpan/Test-Simple/lib/Test2/Util/ExternalMeta.pm
index 31972c6ecd..d4bbf20b82 100644
--- a/cpan/Test-Simple/lib/Test2/Util/ExternalMeta.pm
+++ b/cpan/Test-Simple/lib/Test2/Util/ExternalMeta.pm
@@ -2,7 +2,7 @@ package Test2::Util::ExternalMeta;
use strict;
use warnings;
-our $VERSION = '1.302052';
+our $VERSION = '1.302056';
use Carp qw/croak/;
diff --git a/cpan/Test-Simple/lib/Test2/Util/HashBase.pm b/cpan/Test-Simple/lib/Test2/Util/HashBase.pm
index c91d1c7c72..19cb225373 100644
--- a/cpan/Test-Simple/lib/Test2/Util/HashBase.pm
+++ b/cpan/Test-Simple/lib/Test2/Util/HashBase.pm
@@ -2,7 +2,7 @@ package Test2::Util::HashBase;
use strict;
use warnings;
-our $VERSION = '1.302052';
+our $VERSION = '1.302056';
require Carp;
diff --git a/cpan/Test-Simple/lib/Test2/Util/Trace.pm b/cpan/Test-Simple/lib/Test2/Util/Trace.pm
index 6654589bd0..3ad6578630 100644
--- a/cpan/Test-Simple/lib/Test2/Util/Trace.pm
+++ b/cpan/Test-Simple/lib/Test2/Util/Trace.pm
@@ -2,7 +2,7 @@ package Test2::Util::Trace;
use strict;
use warnings;
-our $VERSION = '1.302052';
+our $VERSION = '1.302056';
use Test2::Util qw/get_tid/;
diff --git a/cpan/Test-Simple/lib/ok.pm b/cpan/Test-Simple/lib/ok.pm
index 7ee3ae9599..e1552c29ff 100644
--- a/cpan/Test-Simple/lib/ok.pm
+++ b/cpan/Test-Simple/lib/ok.pm
@@ -1,5 +1,5 @@
package ok;
-$ok::VERSION = '1.302052';
+$ok::VERSION = '1.302056';
use strict;
use Test::More ();
diff --git a/cpan/Test-Simple/t/Test2/behavior/special_names.t b/cpan/Test-Simple/t/Test2/behavior/special_names.t
new file mode 100644
index 0000000000..90882f5b72
--- /dev/null
+++ b/cpan/Test-Simple/t/Test2/behavior/special_names.t
@@ -0,0 +1,118 @@
+use strict;
+use warnings;
+# HARNESS-NO-FORMATTER
+
+BEGIN { require "t/tools.pl" };
+
+#########################
+#
+# This test us here to insure that Ok renders the way we want
+#
+#########################
+
+use Test2::API qw/test2_stack/;
+
+sub capture(&) {
+ my $code = shift;
+
+ my ($err, $out) = ("", "");
+
+ my $handles = test2_stack->top->format->handles;
+ my ($ok, $e);
+ {
+ my ($out_fh, $err_fh);
+
+ ($ok, $e) = try {
+ open($out_fh, '>', \$out) or die "Failed to open a temporary STDOUT: $!";
+ open($err_fh, '>', \$err) or die "Failed to open a temporary STDERR: $!";
+
+ test2_stack->top->format->set_handles([$out_fh, $err_fh, $out_fh]);
+
+ $code->();
+ };
+ }
+ test2_stack->top->format->set_handles($handles);
+
+ die $e unless $ok;
+
+ $err =~ s/ $/_/mg;
+ $out =~ s/ $/_/mg;
+
+ return {
+ STDOUT => $out,
+ STDERR => $err,
+ };
+}
+
+# Ensure the top hub is generated
+test2_stack->top;
+
+my $temp_hub = test2_stack->new_hub();
+
+my $ok = capture {
+ ok(1);
+ ok(1, "");
+ ok(1, " ");
+ ok(1, "A");
+ ok(1, "\n");
+ ok(1, "\nB");
+ ok(1, "C\n");
+ ok(1, "\nD\n");
+ ok(1, "E\n\n");
+};
+
+my $not_ok = capture {
+ ok(0);
+ ok(0, "");
+ ok(0, " ");
+ ok(0, "A");
+ ok(0, "\n");
+ ok(0, "\nB");
+ ok(0, "C\n");
+ ok(0, "\nD\n");
+ ok(0, "E\n\n");
+};
+
+test2_stack->pop($temp_hub);
+
+is($ok->{STDERR}, "", "STDERR for ok is empty");
+is($ok->{STDOUT}, <<EOT, "STDOUT looks right for ok");
+ok 1
+ok 2 -_
+ok 3 - _
+ok 4 - A
+ok 5 -_
+# _
+ok 6 -_
+# B
+ok 7 - C
+# _
+ok 8 -_
+# D
+# _
+ok 9 - E
+# _
+# _
+EOT
+
+is($not_ok->{STDOUT}, <<EOT, "STDOUT looks right for not ok");
+not ok 10
+not ok 11 -_
+not ok 12 - _
+not ok 13 - A
+not ok 14 -_
+# _
+not ok 15 -_
+# B
+not ok 16 - C
+# _
+not ok 17 -_
+# D
+# _
+not ok 18 - E
+# _
+# _
+EOT
+
+
+done_testing;
diff --git a/cpan/Test-Simple/t/Test2/legacy/TAP.t b/cpan/Test-Simple/t/Test2/legacy/TAP.t
index d98d7445f8..971849f560 100644
--- a/cpan/Test-Simple/t/Test2/legacy/TAP.t
+++ b/cpan/Test-Simple/t/Test2/legacy/TAP.t
@@ -12,6 +12,7 @@ BEGIN { require "t/tools.pl" };
#########################
use Test2::API qw/test2_stack/;
+use Test::Builder::Formatter;
sub capture(&) {
my $code = shift;
@@ -52,11 +53,6 @@ sub tm_ok($;$) {
my ($bool, $name) = @_;
my $ctx = context;
- $name && (
- (index($name, "#" ) >= 0 && $name =~ s|#|\\#|g),
- (index($name, "\n") >= 0 && $name =~ s{\n}{\n# }sg)
- );
-
my $ok = bless {
pass => $bool,
name => $name,
@@ -66,6 +62,7 @@ sub tm_ok($;$) {
# Do not call init
$ctx->hub->send($ok);
+
$ctx->release;
return $bool;
}
diff --git a/cpan/Test-Simple/t/Test2/modules/Event/Ok.t b/cpan/Test-Simple/t/Test2/modules/Event/Ok.t
index ea709f5b85..ad4a1cc21d 100644
--- a/cpan/Test-Simple/t/Test2/modules/Event/Ok.t
+++ b/cpan/Test-Simple/t/Test2/modules/Event/Ok.t
@@ -80,18 +80,6 @@ tests "Failing TODO" => sub {
};
tests init => sub {
- like(
- exception { Test2::Event::Ok->new(trace => $trace, pass => 1, name => "foo#foo") },
- qr/'foo#foo' is not a valid name, names must not contain '#' or newlines/,
- "Some characters do not belong in a name"
- );
-
- like(
- exception { Test2::Event::Ok->new(trace => $trace, pass => 1, name => "foo\nfoo") },
- qr/'foo\nfoo' is not a valid name, names must not contain '#' or newlines/,
- "Some characters do not belong in a name"
- );
-
my $ok = Test2::Event::Ok->new(
trace => $trace,
pass => 1,
diff --git a/cpan/Test-Simple/t/Test2/modules/Formatter/TAP.t b/cpan/Test-Simple/t/Test2/modules/Formatter/TAP.t
index 115e900a95..887db1e5ba 100644
--- a/cpan/Test-Simple/t/Test2/modules/Formatter/TAP.t
+++ b/cpan/Test-Simple/t/Test2/modules/Formatter/TAP.t
@@ -201,6 +201,76 @@ tests note => sub {
);
};
+tests special_characters => sub {
+ my $ok = Test2::Event::Ok->new(
+ trace => $trace,
+ name => 'nothing special',
+ pass => 1,
+ );
+
+ is_deeply(
+ [$fmt->event_tap($ok, 1)],
+ [[OUT_STD, "ok 1 - nothing special\n"]],
+ "Got regular ok"
+ );
+
+ $ok = Test2::Event::Ok->new(
+ trace => $trace,
+ name => 'just a \\ slash',
+ pass => 1,
+ );
+
+ is_deeply(
+ [$fmt->event_tap($ok, 1)],
+ [[OUT_STD, "ok 1 - just a \\ slash\n"]],
+ "Do not escape slashes without a '#'"
+ );
+
+ $ok = Test2::Event::Ok->new(
+ trace => $trace,
+ name => 'a \\ slash and a # hash',
+ pass => 1,
+ );
+
+ is_deeply(
+ [$fmt->event_tap($ok, 1)],
+ [[OUT_STD, "ok 1 - a \\\\ slash and a \\# hash\n"]],
+ "Escape # and any slashes already present"
+ );
+
+ $ok = Test2::Event::Ok->new(
+ trace => $trace,
+ name => "a \\ slash and a # hash\nand \\ some # newlines\nlike this # \\",
+ pass => 1,
+ );
+
+ is_deeply(
+ [$fmt->event_tap($ok, 1)],
+ [
+ [OUT_STD, "ok 1 - a \\\\ slash and a \\# hash\n"],
+ [OUT_STD, "# and \\ some # newlines\n"],
+ [OUT_STD, "# like this # \\\n"],
+ ],
+ "Escape # and any slashes already present, and split newlines, do not escape the newlines"
+ );
+
+ $ok = Test2::Event::Ok->new(
+ trace => $trace,
+ name => "Nothing special until the end \\\nfoo \\ bar",
+ pass => 1,
+ );
+
+ is_deeply(
+ [$fmt->event_tap($ok, 1)],
+ [
+ [OUT_STD, "ok 1 - Nothing special until the end \\\\\n"],
+ [OUT_STD, "# foo \\ bar\n"],
+ ],
+ "Special case, escape things if last character of the first line is a \\"
+ );
+
+};
+
for my $pass (1, 0) {
local $ENV{HARNESS_IS_VERBOSE} = 1;
tests name_and_number => sub {
diff --git a/cpan/Test-Simple/t/Test2/modules/Hub/Interceptor.t b/cpan/Test-Simple/t/Test2/modules/Hub/Interceptor.t
index a1257210a1..a8b21545f0 100644
--- a/cpan/Test-Simple/t/Test2/modules/Hub/Interceptor.t
+++ b/cpan/Test-Simple/t/Test2/modules/Hub/Interceptor.t
@@ -10,6 +10,6 @@ ok($one->isa('Test2::Hub'), "inheritence");;
my $e = exception { $one->terminate(55) };
ok($e->isa('Test2::Hub::Interceptor::Terminator'), "exception type");
-is($$e, 55, "Scalar reference value");
+like($$e, 'Label not found for "last T2_SUBTEST_WRAPPER"', "Could not find label");
done_testing;
diff --git a/cpan/Test-Simple/t/lib/SkipAll.pm b/cpan/Test-Simple/t/lib/SkipAll.pm
new file mode 100644
index 0000000000..4c9e5116d2
--- /dev/null
+++ b/cpan/Test-Simple/t/lib/SkipAll.pm
@@ -0,0 +1,7 @@
+package SkipAll;
+use strict;
+use warnings;
+
+main::skip_all("foo");
+
+1;
diff --git a/cpan/Test-Simple/t/regression/696-intercept_skip_all.t b/cpan/Test-Simple/t/regression/696-intercept_skip_all.t
new file mode 100644
index 0000000000..a9e3463178
--- /dev/null
+++ b/cpan/Test-Simple/t/regression/696-intercept_skip_all.t
@@ -0,0 +1,41 @@
+use strict;
+use warnings;
+
+BEGIN { require "t/tools.pl" };
+
+use Test2::API qw/intercept/;
+
+tests in_eval => sub {
+ my $events = intercept {
+ eval { skip_all "foo" };
+ die "Should not see this: $@";
+ };
+
+ is(@$events, 1, "got 1 event");
+ ok($events->[0]->isa('Test2::Event::Plan'), "Plan is only event");
+ is($events->[0]->directive, 'SKIP', "Plan is to skip");
+};
+
+tests no_eval => sub {
+ my $events = intercept {
+ skip_all "foo";
+ die "Should not see this: $@";
+ };
+
+ is(@$events, 1, "got 1 event");
+ ok($events->[0]->isa('Test2::Event::Plan'), "Plan is only event");
+ is($events->[0]->directive, 'SKIP', "Plan is to skip");
+};
+
+tests in_require => sub {
+ my $events = intercept {
+ require 't/lib/SkipAll.pm';
+ die "Should not see this: $@";
+ };
+
+ is(@$events, 1, "got 1 event");
+ ok($events->[0]->isa('Test2::Event::Plan'), "Plan is only event");
+ is($events->[0]->directive, 'SKIP', "Plan is to skip");
+};
+
+done_testing;