},
'Test::Simple' => {
- 'DISTRIBUTION' => 'EXODIST/Test-Simple-1.302164.tar.gz',
+ 'DISTRIBUTION' => 'EXODIST/Test-Simple-1.302166.tar.gz',
'FILES' => q[cpan/Test-Simple],
'EXCLUDED' => [
qr{^examples/},
use strict;
use warnings;
-our $VERSION = '1.302164';
+our $VERSION = '1.302166';
BEGIN {
if( $] < 5.008 ) {
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.
use strict;
use warnings;
-our $VERSION = '1.302164';
+our $VERSION = '1.302166';
BEGIN { require Test2::Formatter::TAP; our @ISA = qw(Test2::Formatter::TAP) }
require Exporter;
our @ISA = qw(Exporter);
-our $VERSION = '1.302164';
+our $VERSION = '1.302166';
=head1 NAME
package Test::Builder::Tester;
use strict;
-our $VERSION = '1.302164';
+our $VERSION = '1.302166';
use Test::Builder;
use Symbol;
package Test::Builder::Tester::Color;
use strict;
-our $VERSION = '1.302164';
+our $VERSION = '1.302166';
require Test::Builder::Tester;
use strict;
use warnings;
-our $VERSION = '1.302164';
+our $VERSION = '1.302166';
BEGIN { require Test2::Event::Diag; our @ISA = qw(Test2::Event::Diag) }
return warn @_, " at $file line $line\n";
}
-our $VERSION = '1.302164';
+our $VERSION = '1.302166';
use Test::Builder::Module;
our @ISA = qw(Test::Builder::Module);
use strict;
-our $VERSION = '1.302164';
+our $VERSION = '1.302166';
use Test::Builder::Module;
our @ISA = qw(Test::Builder::Module);
use vars qw( @ISA @EXPORT );
-our $VERSION = '1.302164';
+our $VERSION = '1.302166';
@EXPORT = qw( run_tests check_tests check_test cmp_results show_space );
@ISA = qw( Exporter );
package Test::Tester::Capture;
-our $VERSION = '1.302164';
+our $VERSION = '1.302166';
use Test::Builder;
package Test::Tester::CaptureRunner;
-our $VERSION = '1.302164';
+our $VERSION = '1.302166';
use Test::Tester::Capture;
package Test::Tester::Delegate;
-our $VERSION = '1.302164';
+our $VERSION = '1.302166';
use Scalar::Util();
package Test::use::ok;
use 5.005;
-our $VERSION = '1.302164';
+our $VERSION = '1.302166';
__END__
use strict;
use warnings;
-our $VERSION = '1.302164';
+our $VERSION = '1.302166';
1;
$ENV{TEST2_ACTIVE} = 1;
}
-our $VERSION = '1.302164';
+our $VERSION = '1.302166';
my $INST;
my $ENDING = 0;
-sub test2_set_is_end { ($ENDING) = @_ ? @_ : (1) }
+sub test2_unset_is_end { $ENDING = 0 }
sub test2_get_is_end { $ENDING }
+sub test2_set_is_end {
+ my $before = $ENDING;
+ ($ENDING) = @_ ? @_ : (1);
+
+ # Only send the event in a transition from false to true
+ return if $before;
+ return unless $ENDING;
+
+ return unless $INST;
+ my $stack = $INST->stack or return;
+ my $root = $stack->root or return;
+
+ return unless $$ == $INST->pid;
+ return unless get_tid() == $INST->tid;
+
+ my $trace = Test2::EventFacet::Trace->new(
+ frame => [__PACKAGE__, __FILE__, __LINE__, __PACKAGE__ . '::test2_set_is_end'],
+ );
+ my $ctx = Test2::API::Context->new(
+ trace => $trace,
+ hub => $root,
+ );
+
+ $ctx->send_ev2(control => { phase => 'END', details => 'Transition to END phase' });
+
+ 1;
+}
+
use Test2::API::Instance(\$INST);
# Set the exit status
test2_in_preload
test2_set_is_end
+ test2_unset_is_end
test2_get_is_end
test2_pid
use strict;
use warnings;
-our $VERSION = '1.302164';
+our $VERSION = '1.302166';
use Test2::Util qw/pkg_to_file/;
use strict;
use warnings;
-our $VERSION = '1.302164';
+our $VERSION = '1.302166';
use Carp qw/confess croak/;
# show the warning about using eq.
no warnings 'uninitialized';
if($self->{+EVAL_ERROR} eq $@ && $hub->is_local) {
+ require Carp;
+ my $mess = Carp::longmess("Context destroyed");
my $frame = $self->{+_IS_SPAWN} || $self->{+TRACE}->frame;
warn <<" EOT";
A context appears to have been destroyed without first calling release().
Line: $frame->[2]
Tool: $frame->[3]
+Here is a trace to the code that caused the context to be destroyed, this could
+be an exit(), a goto, or simply the end of a scope:
+$mess
+
Cleaning up the CONTEXT stack...
EOT
}
use strict;
use warnings;
-our $VERSION = '1.302164';
+our $VERSION = '1.302166';
our @CARP_NOT = qw/Test2::API Test2::API::Instance Test2::IPC::Driver Test2::Formatter/;
use Carp qw/confess carp/;
use strict;
use warnings;
-our $VERSION = '1.302164';
+our $VERSION = '1.302166';
use Test2::Hub();
return @$self;
}
+sub root {
+ my $self = shift;
+ return unless @$self;
+ return $self->[0];
+}
+
sub clear {
my $self = shift;
@$self = ();
use strict;
use warnings;
-our $VERSION = '1.302164';
+our $VERSION = '1.302166';
use Scalar::Util qw/blessed reftype/;
use Carp qw/croak/;
Facets are produced by the C<facet_data()> subroutine, which you should
nearly-always override. C<facet_data()> is expected to return a hashref where
each key is the facet type, and the value is either a hashref with the data for
-that facet, or an array of hashref's. Some facets must be defined as single
+that facet, or an array of hashrefs. Some facets must be defined as single
hashrefs, some must be defined as an array of hashrefs, No facets allow both.
C<facet_data()> B<MUST NOT> bless the data it returns, the main hashref, and
-nested facet hashref's B<MUST> be bare, though items contained within each
+nested facet hashrefs B<MUST> be bare, though items contained within each
facet may be blessed. The data returned by this method B<should> also be copies
of the internal data in order to prevent accidental state modification.
use strict;
use warnings;
-our $VERSION = '1.302164';
+our $VERSION = '1.302166';
BEGIN { require Test2::Event; our @ISA = qw(Test2::Event) }
use strict;
use warnings;
-our $VERSION = '1.302164';
+our $VERSION = '1.302166';
BEGIN { require Test2::Event; our @ISA = qw(Test2::Event) }
use strict;
use warnings;
-our $VERSION = '1.302164';
+our $VERSION = '1.302166';
use Carp qw/croak/;
use strict;
use warnings;
-our $VERSION = '1.302164';
+our $VERSION = '1.302166';
BEGIN { require Test2::Event; our @ISA = qw(Test2::Event) }
use strict;
use warnings;
-our $VERSION = '1.302164';
+our $VERSION = '1.302166';
use Test2::EventFacet::Info;
use Carp qw/croak/;
use Scalar::Util qw/reftype/;
-our $VERSION = '1.302164';
+our $VERSION = '1.302166';
BEGIN { require Test2::Event; our @ISA = qw(Test2::Event) }
use Test2::Util::HashBase;
use strict;
use warnings;
-our $VERSION = '1.302164';
+our $VERSION = '1.302166';
BEGIN { require Test2::Event; our @ISA = qw(Test2::Event) }
use strict;
use warnings;
-our $VERSION = '1.302164';
+our $VERSION = '1.302166';
BEGIN { require Test2::Event; our @ISA = qw(Test2::Event) }
use strict;
use warnings;
-our $VERSION = '1.302164';
+our $VERSION = '1.302166';
use Test2::EventFacet::Info;
use strict;
use warnings;
-our $VERSION = '1.302164';
+our $VERSION = '1.302166';
BEGIN { require Test2::Event; our @ISA = qw(Test2::Event) }
use strict;
use warnings;
-our $VERSION = '1.302164';
+our $VERSION = '1.302166';
BEGIN { require Test2::Event::Ok; our @ISA = qw(Test2::Event::Ok) }
use strict;
use warnings;
-our $VERSION = '1.302164';
+our $VERSION = '1.302166';
BEGIN { require Test2::Event::Ok; our @ISA = qw(Test2::Event::Ok) }
use Test2::Util::HashBase qw{subevents buffered subtest_id subtest_uuid};
use strict;
use warnings;
-our $VERSION = '1.302164';
+our $VERSION = '1.302166';
use Carp qw/croak/;
use strict;
use warnings;
-our $VERSION = '1.302164';
+our $VERSION = '1.302166';
use Scalar::Util qw/reftype/;
use Carp qw/croak/;
use strict;
use warnings;
-our $VERSION = '1.302164';
+our $VERSION = '1.302166';
BEGIN { require Test2::Event; our @ISA = qw(Test2::Event) }
use strict;
use warnings;
-our $VERSION = '1.302164';
+our $VERSION = '1.302166';
use Test2::Util::HashBase qw/-details/;
use Carp qw/croak/;
use strict;
use warnings;
-our $VERSION = '1.302164';
+our $VERSION = '1.302166';
BEGIN { require Test2::EventFacet; our @ISA = qw(Test2::EventFacet) }
use Test2::Util::HashBase qw{ -package -no_display -uuid -eid };
use strict;
use warnings;
-our $VERSION = '1.302164';
+our $VERSION = '1.302166';
sub is_list { 1 }
use strict;
use warnings;
-our $VERSION = '1.302164';
+our $VERSION = '1.302166';
BEGIN { require Test2::EventFacet; our @ISA = qw(Test2::EventFacet) }
use Test2::Util::HashBase qw{ -pass -no_debug -number };
use strict;
use warnings;
-our $VERSION = '1.302164';
+our $VERSION = '1.302166';
BEGIN { require Test2::EventFacet; our @ISA = qw(Test2::EventFacet) }
-use Test2::Util::HashBase qw{ -global -terminate -halt -has_callback -encoding };
+use Test2::Util::HashBase qw{ -global -terminate -halt -has_callback -encoding -phase };
1;
This can be used to change the encoding from this event onward.
+=item $phase = $control->{phase}
+
+=item $phase = $control->phase()
+
+Used to signal that a phase change has occurred. Currently only the perl END
+phase is signaled.
+
=back
=head1 SOURCE
use strict;
use warnings;
-our $VERSION = '1.302164';
+our $VERSION = '1.302166';
sub facet_key { 'errors' }
sub is_list { 1 }
use strict;
use warnings;
-our $VERSION = '1.302164';
+our $VERSION = '1.302166';
sub is_list { 1 }
sub facet_key { 'hubs' }
use strict;
use warnings;
-our $VERSION = '1.302164';
+our $VERSION = '1.302166';
sub is_list { 1 }
use strict;
use warnings;
-our $VERSION = '1.302164';
+our $VERSION = '1.302166';
use Carp qw/confess/;
use strict;
use warnings;
-our $VERSION = '1.302164';
+our $VERSION = '1.302166';
BEGIN { require Test2::EventFacet; our @ISA = qw(Test2::EventFacet) }
use vars qw/$AUTOLOAD/;
use strict;
use warnings;
-our $VERSION = '1.302164';
+our $VERSION = '1.302166';
use Carp qw/confess/;
use strict;
use warnings;
-our $VERSION = '1.302164';
+our $VERSION = '1.302166';
BEGIN { require Test2::EventFacet; our @ISA = qw(Test2::EventFacet) }
use Test2::Util::HashBase qw{ -count -skip -none };
use strict;
use warnings;
-our $VERSION = '1.302164';
+our $VERSION = '1.302166';
sub is_list { 1 }
use strict;
use warnings;
-our $VERSION = '1.302164';
+our $VERSION = '1.302166';
BEGIN { require Test2::EventFacet; our @ISA = qw(Test2::EventFacet) }
use strict;
use warnings;
-our $VERSION = '1.302164';
+our $VERSION = '1.302166';
my %ADDED;
use strict;
use warnings;
-our $VERSION = '1.302164';
+our $VERSION = '1.302166';
use Test2::Util qw/clone_io/;
use strict;
use warnings;
-our $VERSION = '1.302164';
+our $VERSION = '1.302166';
use Carp qw/carp croak confess/;
use strict;
use warnings;
-our $VERSION = '1.302164';
+our $VERSION = '1.302166';
use Test2::Hub::Interceptor::Terminator();
use strict;
use warnings;
-our $VERSION = '1.302164';
+our $VERSION = '1.302166';
1;
use strict;
use warnings;
-our $VERSION = '1.302164';
+our $VERSION = '1.302166';
BEGIN { require Test2::Hub; our @ISA = qw(Test2::Hub) }
use Test2::Util::HashBase qw/nested exit_code manual_skip_all/;
use strict;
use warnings;
-our $VERSION = '1.302164';
+our $VERSION = '1.302166';
use Test2::API::Instance;
use strict;
use warnings;
-our $VERSION = '1.302164';
+our $VERSION = '1.302166';
use Carp qw/confess/;
use strict;
use warnings;
-our $VERSION = '1.302164';
+our $VERSION = '1.302166';
BEGIN { require Test2::IPC::Driver; our @ISA = qw(Test2::IPC::Driver) }
use Test2::Hub::Interceptor();
use Test2::Hub::Interceptor::Terminator();
-our $VERSION = '1.302164';
+our $VERSION = '1.302166';
BEGIN { require Exporter; our @ISA = qw(Exporter) }
our @EXPORT = qw{
use strict;
use warnings;
-our $VERSION = '1.302164';
+our $VERSION = '1.302166';
use POSIX();
use Config qw/%Config/;
use strict;
use warnings;
-our $VERSION = '1.302164';
+our $VERSION = '1.302166';
use Carp qw/croak/;
use strict;
use warnings;
-our $VERSION = '1.302164';
+our $VERSION = '1.302166';
use Carp qw/croak confess/;
use Scalar::Util qw/blessed/;
use strict;
use warnings;
-our $VERSION = '1.302164';
+our $VERSION = '1.302166';
#################################################################
# #
require Test2::EventFacet::Trace;
@ISA = ('Test2::EventFacet::Trace');
-our $VERSION = '1.302164';
+our $VERSION = '1.302166';
1;
package ok;
-our $VERSION = '1.302164';
+our $VERSION = '1.302166';
use strict;
use Test::More ();
}->();
+sub ctx_destroy_test {
+ my (undef, undef, $line1) = caller();
+ my (@warn, $line2);
+ local $SIG{__WARN__} = sub { push @warn => $_[0] };
+
+ { my $ctx = context(); $ctx = undef } $line2 = __LINE__;
+
+ use Data::Dumper;
+# print Dumper(@warn);
+
+ like($warn[0], qr/context appears to have been destroyed without first calling release/, "Is normal context warning");
+ like($warn[0], qr{\QContext destroyed at ${ \__FILE__ } line $line2\E}, "Reported context destruction trace");
+
+ my $created = <<" EOT";
+Here are the context creation details, just in case a tool forgot to call
+release():
+ File: ${ \__FILE__ }
+ Line: $line1
+ Tool: main::ctx_destroy_test
+ EOT
+
+ like($warn[0], qr{\Q$created\E}, "Reported context creation details");
+};
+
+ctx_destroy_test();
+
done_testing;
my $out = $self->common_facet_data;
- $out->{errors} = [{tag => 'OOPS', fail => !$ENV{FAILURE_DO_PASS}, details => "An error occured"}];
+ $out->{errors} = [{tag => 'OOPS', fail => !$ENV{FAILURE_DO_PASS}, details => "An error occurred"}];
return $out;
}