use strict;
use warnings;
-our $VERSION = '1.302111';
+our $VERSION = '1.302173';
BEGIN {
if( $] < 5.008 ) {
warn "Test::Builder was loaded after Test2 initialization, this is not recommended."
if Test2::API::test2_init_done() || Test2::API::test2_load_done();
- if (USE_THREADS) {
+ if (USE_THREADS && ! Test2::API::test2_ipc_disabled()) {
require Test2::IPC;
require Test2::IPC::Driver::Files;
Test2::IPC::Driver::Files->import;
Test2::API::test2_ipc_enable_polling();
Test2::API::test2_no_wait(1);
- Test2::API::test2_ipc_enable_shm();
}
}
$todo = ${"$cpkg\::TODO"} if $cpkg;
$todo = ${"$epkg\::TODO"} if $epkg && !$todo;
- return $e unless $todo;
+ return $e unless defined($todo);
+ return $e unless length($todo);
# Turn a diag into a todo diag
return Test::Builder::TodoDiag->new(%$e) if ref($e) eq 'Test2::Event::Diag';
- if ($active_hub == $hub) {
- $e->set_todo($todo) if $e->can('set_todo');
- $e->add_amnesty({tag => 'TODO', details => $todo});
- }
- else {
- $e->add_amnesty({tag => 'TODO', details => $todo, inherited => 1});
- }
+ $e->set_todo($todo) if $e->can('set_todo');
+ $e->add_amnesty({tag => 'TODO', details => $todo});
# Set todo on ok's
if ($e->isa('Test2::Event::Ok')) {
Test2::API::test2_add_callback_exit(sub { $Test->_ending(@_) });
- Test2::API::test2_ipc()->set_no_fatal(1) if USE_THREADS;
+ Test2::API::test2_ipc()->set_no_fatal(1) if Test2::API::test2_has_ipc();
}
return $Test;
}
$meta->{Test_Results} = [];
$meta->{subevents} = $subevents;
$meta->{subtest_id} = $hub->id;
+ $meta->{subtest_uuid} = $hub->uuid;
$meta->{subtest_buffered} = $parent->format ? 0 : 1;
$self->_add_ts_hooks;
else {
$parent->{subevents} = $meta->{subevents};
$parent->{subtest_id} = $meta->{subtest_id};
+ $parent->{subtest_uuid} = $meta->{subtest_uuid};
$parent->{subtest_buffered} = $meta->{subtest_buffered};
$parent->ok( $chub->is_passing, $meta->{Name} );
}
$name ||= "Child of " . $self->name;
+
+ $_->($name,$code,@args)
+ for Test2::API::test2_list_pre_subtest_callbacks();
+
$ctx->note("Subtest: $name");
my $child = $self->child($name);
sub reset { ## no critic (Subroutines::ProhibitBuiltinHomonyms)
my ($self, %params) = @_;
- Test2::API::test2_set_is_end(0);
+ Test2::API::test2_unset_is_end();
# We leave this a global because it has to be localized and localizing
# hash keys is just asking for pain. Also, it was documented.
my @attrs;
my $subevents = delete $self->{subevents};
my $subtest_id = delete $self->{subtest_id};
+ my $subtest_uuid = delete $self->{subtest_uuid};
my $subtest_buffered = delete $self->{subtest_buffered};
my $epkg = 'Test2::Event::Ok';
if ($subevents) {
$epkg = 'Test2::Event::Subtest';
- push @attrs => (subevents => $subevents, subtest_id => $subtest_id, buffered => $subtest_buffered);
+ push @attrs => (subevents => $subevents, subtest_id => $subtest_id, subtest_uuid => $subtest_uuid, buffered => $subtest_buffered);
}
my $e = bless {
my $self = shift;
my ($trace, $orig_name) = @_;
- my $is_todo = defined($self->todo);
+ my $is_todo = $self->in_todo;
my $msg = $is_todo ? "Failed (TODO)" : "Failed";
my $ipc = Test2::IPC::apply_ipc($self->{Stack});
$ipc->set_no_fatal(1);
Test2::API::test2_no_wait(1);
- Test2::API::test2_ipc_enable_shm();
}
sub no_log_results { $_[0]->{no_log_results} = 1 }
Test::Builder is only thread-aware if threads.pm is loaded I<before>
Test::Builder.
+You can directly disable thread support with one of the following:
+
+ $ENV{T2_NO_IPC} = 1
+
+or
+
+ no Test2::IPC;
+
+or
+
+ Test2::API::test2_ipc_disable()
+
=head1 MEMORY
An informative hash, accessible via C<details()>, is stored for each
=head1 SEE ALSO
-L<Test::Simple>, L<Test::More>, L<Test::Harness>
+=head2 INTERNALS
+
+L<Test2>, L<Test2::API>
+
+=head2 LEGACY
+
+L<Test::Simple>, L<Test::More>
+
+=head2 EXTERNAL
+
+L<Test::Harness>
=head1 AUTHORS