Skip to content

Commit

Permalink
cpan/Test-Simple - Update to version 1.302197
Browse files Browse the repository at this point in the history
1.302197  2023-11-28 17:30:37-08:00 America/Los_Angeles

    - Add ability to attach timestamps to trace objects via api or env var

1.302196  2023-10-24 10:27:33-07:00 America/Los_Angeles

    - Fix #882
    - Fix handling of VSTRING and LVALUE refs in is_deeply() #918
    - Merge several doc fixes from mauke
  • Loading branch information
Chad Granum authored and jkeenan committed Nov 29, 2023
1 parent 83342bd commit 2ae2f22
Show file tree
Hide file tree
Showing 78 changed files with 243 additions and 114 deletions.
1 change: 1 addition & 0 deletions MANIFEST
Expand Up @@ -2793,6 +2793,7 @@ cpan/Test-Simple/t/Test2/behavior/Subtest_plan.t Test file related to Test::S
cpan/Test-Simple/t/Test2/behavior/Subtest_todo.t Test file related to Test::Simple
cpan/Test-Simple/t/Test2/behavior/Taint.t Test file related to Test::Simple
cpan/Test-Simple/t/Test2/behavior/trace_signature.t Test file related to Test::Simple
cpan/Test-Simple/t/Test2/behavior/trace_stamps.t Test-Simple
cpan/Test-Simple/t/Test2/behavior/uuid.t Test file related to Test::Simple
cpan/Test-Simple/t/Test2/legacy/TAP.t Test file related to Test::Simple
cpan/Test-Simple/t/Test2/modules/API.t Test file related to Test::Simple
Expand Down
3 changes: 2 additions & 1 deletion Porting/Maintainers.pl
Expand Up @@ -1104,7 +1104,8 @@ package Maintainers;
},

'Test::Simple' => {
'DISTRIBUTION' => 'EXODIST/Test-Simple-1.302195.tar.gz',
'DISTRIBUTION' => 'EXODIST/Test-Simple-1.302197.tar.gz',
'SYNCINFO' => 'jkeenan on Wed Nov 29 11:41:51 2023',
'FILES' => q[cpan/Test-Simple],
'EXCLUDED' => [
qr{^examples/},
Expand Down
2 changes: 1 addition & 1 deletion cpan/Test-Simple/lib/Test/Builder.pm
Expand Up @@ -4,7 +4,7 @@ use 5.006;
use strict;
use warnings;

our $VERSION = '1.302195';
our $VERSION = '1.302197';

BEGIN {
if( $] < 5.008 ) {
Expand Down
2 changes: 1 addition & 1 deletion cpan/Test-Simple/lib/Test/Builder/Formatter.pm
Expand Up @@ -2,7 +2,7 @@ package Test::Builder::Formatter;
use strict;
use warnings;

our $VERSION = '1.302195';
our $VERSION = '1.302197';

BEGIN { require Test2::Formatter::TAP; our @ISA = qw(Test2::Formatter::TAP) }

Expand Down
2 changes: 1 addition & 1 deletion cpan/Test-Simple/lib/Test/Builder/Module.pm
Expand Up @@ -7,7 +7,7 @@ use Test::Builder;
require Exporter;
our @ISA = qw(Exporter);

our $VERSION = '1.302195';
our $VERSION = '1.302197';


=head1 NAME
Expand Down
2 changes: 1 addition & 1 deletion cpan/Test-Simple/lib/Test/Builder/Tester.pm
@@ -1,7 +1,7 @@
package Test::Builder::Tester;

use strict;
our $VERSION = '1.302195';
our $VERSION = '1.302197';

use Test::Builder;
use Symbol;
Expand Down
2 changes: 1 addition & 1 deletion cpan/Test-Simple/lib/Test/Builder/Tester/Color.pm
@@ -1,7 +1,7 @@
package Test::Builder::Tester::Color;

use strict;
our $VERSION = '1.302195';
our $VERSION = '1.302197';

require Test::Builder::Tester;

Expand Down
2 changes: 1 addition & 1 deletion cpan/Test-Simple/lib/Test/Builder/TodoDiag.pm
Expand Up @@ -2,7 +2,7 @@ package Test::Builder::TodoDiag;
use strict;
use warnings;

our $VERSION = '1.302195';
our $VERSION = '1.302197';

BEGIN { require Test2::Event::Diag; our @ISA = qw(Test2::Event::Diag) }

Expand Down
21 changes: 18 additions & 3 deletions cpan/Test-Simple/lib/Test/More.pm
Expand Up @@ -17,7 +17,7 @@ sub _carp {
return warn @_, " at $file line $line\n";
}

our $VERSION = '1.302195';
our $VERSION = '1.302197';

use Test::Builder::Module;
our @ISA = qw(Test::Builder::Module);
Expand Down Expand Up @@ -1206,13 +1206,28 @@ sub _format_stack {
return $out;
}

my %_types = (
(map +($_ => $_), qw(
Regexp
ARRAY
HASH
SCALAR
REF
GLOB
CODE
)),
'LVALUE' => 'SCALAR',
'REF' => 'SCALAR',
'VSTRING' => 'SCALAR',
);

sub _type {
my $thing = shift;

return '' if !ref $thing;

for my $type (qw(Regexp ARRAY HASH REF SCALAR GLOB CODE VSTRING)) {
return $type if UNIVERSAL::isa( $thing, $type );
for my $type (keys %_types) {
return $_types{$type} if UNIVERSAL::isa( $thing, $type );
}

return '';
Expand Down
2 changes: 1 addition & 1 deletion cpan/Test-Simple/lib/Test/Simple.pm
Expand Up @@ -4,7 +4,7 @@ use 5.006;

use strict;

our $VERSION = '1.302195';
our $VERSION = '1.302197';

use Test::Builder::Module;
our @ISA = qw(Test::Builder::Module);
Expand Down
2 changes: 1 addition & 1 deletion cpan/Test-Simple/lib/Test/Tester.pm
Expand Up @@ -18,7 +18,7 @@ require Exporter;

use vars qw( @ISA @EXPORT );

our $VERSION = '1.302195';
our $VERSION = '1.302197';

@EXPORT = qw( run_tests check_tests check_test cmp_results show_space );
@ISA = qw( Exporter );
Expand Down
2 changes: 1 addition & 1 deletion cpan/Test-Simple/lib/Test/Tester/Capture.pm
Expand Up @@ -2,7 +2,7 @@ use strict;

package Test::Tester::Capture;

our $VERSION = '1.302195';
our $VERSION = '1.302197';


use Test::Builder;
Expand Down
2 changes: 1 addition & 1 deletion cpan/Test-Simple/lib/Test/Tester/CaptureRunner.pm
Expand Up @@ -3,7 +3,7 @@ use strict;

package Test::Tester::CaptureRunner;

our $VERSION = '1.302195';
our $VERSION = '1.302197';


use Test::Tester::Capture;
Expand Down
2 changes: 1 addition & 1 deletion cpan/Test-Simple/lib/Test/Tester/Delegate.pm
Expand Up @@ -3,7 +3,7 @@ use warnings;

package Test::Tester::Delegate;

our $VERSION = '1.302195';
our $VERSION = '1.302197';

use Scalar::Util();

Expand Down
2 changes: 1 addition & 1 deletion cpan/Test-Simple/lib/Test/use/ok.pm
@@ -1,7 +1,7 @@
package Test::use::ok;
use 5.005;

our $VERSION = '1.302195';
our $VERSION = '1.302197';


__END__
Expand Down
2 changes: 1 addition & 1 deletion cpan/Test-Simple/lib/Test2.pm
Expand Up @@ -2,7 +2,7 @@ package Test2;
use strict;
use warnings;

our $VERSION = '1.302195';
our $VERSION = '1.302197';


1;
Expand Down
64 changes: 51 additions & 13 deletions cpan/Test-Simple/lib/Test2/API.pm
Expand Up @@ -10,7 +10,7 @@ BEGIN {
$ENV{TEST2_ACTIVE} = 1;
}

our $VERSION = '1.302195';
our $VERSION = '1.302197';


my $INST;
Expand Down Expand Up @@ -171,6 +171,10 @@ our @EXPORT_OK = qw{
test2_stdout
test2_stderr
test2_reset_io
test2_enable_trace_stamps
test2_disable_trace_stamps
test2_trace_stamps_enabled
};
BEGIN { require Exporter; our @ISA = qw(Exporter) }

Expand Down Expand Up @@ -209,6 +213,10 @@ sub test2_ipc_wait_enable { $INST->set_no_wait(0) }
sub test2_ipc_wait_disable { $INST->set_no_wait(1) }
sub test2_ipc_wait_enabled { !$INST->no_wait }

sub test2_enable_trace_stamps { $INST->test2_enable_trace_stamps }
sub test2_disable_trace_stamps { $INST->test2_disable_trace_stamps }
sub test2_trace_stamps_enabled { $INST->test2_trace_stamps_enabled }

sub test2_is_testing_done {
# No instance? VERY DONE!
return 1 unless $INST;
Expand Down Expand Up @@ -240,7 +248,7 @@ sub test2_add_callback_testing_done {

test2_add_callback_post_load(sub {
my $stack = test2_stack();
$stack->top; # Insure we have a hub
$stack->top; # Ensure we have a hub
my ($hub) = Test2::API::test2_stack->all;

$hub->set_active(1);
Expand Down Expand Up @@ -380,8 +388,15 @@ sub context {
# Catch an edge case where we try to get context after the root hub has
# been garbage collected resulting in a stack that has a single undef
# hub
if (!$hub && !exists($params{hub}) && @$stack) {
my $msg = Carp::longmess("Attempt to get Test2 context after testing has completed (did you attempt a testing event after done_testing?)");
if (!($hub && $hub->{hid}) && !exists($params{hub}) && @$stack) {
my $msg;

if ($hub && !$hub->{hid}) {
$msg = Carp::longmess("$hub has no hid! (did you attempt a testing event after done_testing?). You may be relying on a tool or plugin that was based off an old Test2 that did not require hids.");
}
else {
$msg = Carp::longmess("Attempt to get Test2 context after testing has completed (did you attempt a testing event after done_testing?)");
}

# The error message is usually masked by the global destruction, so we have to print to STDER
print STDERR $msg;
Expand Down Expand Up @@ -463,6 +478,8 @@ sub context {

full_caller => [$pkg, $file, $line, $sub, @other],

$INST->{trace_stamps} ? (stamp => time()) : (),

$$UUID_VIA ? (
huuid => $hub->{uuid},
uuid => ${$UUID_VIA}->('context'),
Expand Down Expand Up @@ -920,7 +937,7 @@ what you can and cannot do with a context once it is obtained.
B<Note> This function will throw an exception if you ignore the context object
it returns.
B<Note> On perls 5.14+ a depth check is used to insure there are no context
B<Note> On perls 5.14+ a depth check is used to ensure there are no context
leaks. This cannot be safely done on older perls due to
L<https://rt.perl.org/Public/Bug/Display.html?id=127774>
You can forcefully enable it either by setting C<$ENV{T2_CHECK_DEPTH} = 1> or
Expand Down Expand Up @@ -1088,8 +1105,8 @@ Usage:
Using this inside your test tool takes care of a lot of boilerplate for you. It
will ensure a context is acquired. It will capture and rethrow any exception. It
will insure the context is released when you are done. It preserves the
subroutine call context (array, scalar, void).
will ensure the context is released when you are done. It preserves the
subroutine call context (list, scalar, void).
This is the safest way to write a test tool. The only two downsides to this are a
slight performance decrease, and some extra indentation in your source. If the
Expand Down Expand Up @@ -1229,7 +1246,7 @@ formatter being used.
=over 4
=item Things not effected by this flag
=item Things not affected by this flag
In both cases events are generated and stored in an array. This array is
eventually used to populate the C<subevents> attribute on the
Expand All @@ -1239,13 +1256,13 @@ This flag has no effect on this part, it always happens.
At the end of the subtest, the final L<Test2::Event::Subtest> event is sent to
the formatter.
=item Things that are effected by this flag
=item Things that are affected by this flag
The C<buffered> attribute of the L<Test2::Event::Subtest> event will be set to
the value of this flag. This means any formatter, listener, etc which looks at
the event will know if it was buffered.
=item Things that are formatter dependant
=item Things that are formatter dependent
Events within a buffered subtest may or may not be sent to the formatter as
they happen. If a formatter fails to specify then the default is to B<NOT SEND>
Expand Down Expand Up @@ -1432,7 +1449,7 @@ This is essentially a helper to do the following:
test2_add_callback_post_load(sub {
my $stack = test2_stack();
$stack->top; # Insure we have a hub
$stack->top; # Ensure we have a hub
my ($hub) = Test2::API::test2_stack->all;
$hub->set_active(1);
Expand Down Expand Up @@ -1624,6 +1641,27 @@ this is called after initialization a warning will be issued.
=back
=head2 TIME STAMPS
You can enable or disable timestamps in trace facets. They are disabled by
default for compatibility and performance reasons.
=over 4
=item test2_enable_trace_stamps()
Enable stamps in traces.
=item test2_disable_trace_stamps()
Disable stamps in traces.
=item $bool = test2_trace_stamps_enabled()
Check status of trace stamps.
=back
=head1 OTHER EXAMPLES
See the C</Examples/> directory included in this distribution.
Expand All @@ -1650,7 +1688,7 @@ can be added to this package.
=head1 SOURCE
The source code repository for Test2 can be found at
F<http://github.com/Test-More/test-more/>.
L<https://github.com/Test-More/test-more/>.
=head1 MAINTAINERS
Expand All @@ -1675,6 +1713,6 @@ Copyright 2020 Chad Granum E<lt>exodist@cpan.orgE<gt>.
This program is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.
See F<http://dev.perl.org/licenses/>
See L<https://dev.perl.org/licenses/>
=cut
2 changes: 1 addition & 1 deletion cpan/Test-Simple/lib/Test2/API/Breakage.pm
Expand Up @@ -2,7 +2,7 @@ package Test2::API::Breakage;
use strict;
use warnings;

our $VERSION = '1.302195';
our $VERSION = '1.302197';


use Test2::Util qw/pkg_to_file/;
Expand Down
4 changes: 2 additions & 2 deletions cpan/Test-Simple/lib/Test2/API/Context.pm
Expand Up @@ -2,7 +2,7 @@ package Test2::API::Context;
use strict;
use warnings;

our $VERSION = '1.302195';
our $VERSION = '1.302197';


use Carp qw/confess croak/;
Expand Down Expand Up @@ -612,7 +612,7 @@ context was created.
B<Note:> If a context is acquired more than once an internal refcount is kept.
C<release()> decrements the ref count, none of the other actions of
C<release()> will occur unless the refcount hits 0. This means only the last
call to C<release()> will reset C<$?>, C<$!>, C<$@>,and run the cleanup tasks.
call to C<release()> will reset C<$?>, C<$!>, C<$@>, and run the cleanup tasks.
=item $ctx->throw($message)
Expand Down

0 comments on commit 2ae2f22

Please sign in to comment.