diff options
author | Chad Granum <exodist7@gmail.com> | 2015-01-31 12:19:22 -0800 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2015-01-31 13:57:08 -0800 |
commit | 18864292b4751beee108b3b4983f9ddf2228f8ef (patch) | |
tree | 89c294cebeb7bcf29136a9be7c1fd29cb72616bb /cpan | |
parent | ad51375676d14fd63b202ee0090e1351632109ff (diff) | |
download | perl-18864292b4751beee108b3b4983f9ddf2228f8ef.tar.gz |
Test-Simple Version Bump, 1.301001_098 (RC18)
Diffstat (limited to 'cpan')
61 files changed, 1306 insertions, 196 deletions
diff --git a/cpan/Test-Simple/lib/Test/Builder.pm b/cpan/Test-Simple/lib/Test/Builder.pm index c690851621..11dadc7140 100644 --- a/cpan/Test-Simple/lib/Test/Builder.pm +++ b/cpan/Test-Simple/lib/Test/Builder.pm @@ -4,7 +4,7 @@ use 5.008001; use strict; use warnings; -our $VERSION = '1.301001_097'; +our $VERSION = '1.301001_098'; $VERSION = eval $VERSION; ## no critic (BuiltinFunctions::ProhibitStringyEval) @@ -955,6 +955,8 @@ __END__ =pod +=encoding UTF-8 + =head1 NAME Test::Builder - *DEPRECATED* Module for building testing libraries. @@ -1217,8 +1219,6 @@ work, however in the distant future it will be removed. L<Test::Stream> upon which Test::Builder is now built, provides hooks and API's for doing everything that previously required monkeypatching. -=encoding utf8 - =head1 TUTORIALS =over 4 diff --git a/cpan/Test-Simple/lib/Test/Builder/Module.pm b/cpan/Test-Simple/lib/Test/Builder/Module.pm index ff109f85be..a5d8eba73e 100644 --- a/cpan/Test-Simple/lib/Test/Builder/Module.pm +++ b/cpan/Test-Simple/lib/Test/Builder/Module.pm @@ -8,9 +8,12 @@ use Test::Builder 0.99; require Exporter; our @ISA = qw(Exporter); -our $VERSION = '1.301001_097'; +our $VERSION = '1.301001_098'; $VERSION = eval $VERSION; ## no critic (BuiltinFunctions::ProhibitStringyEval) +=pod + +=encoding UTF-8 =head1 NAME @@ -185,8 +188,6 @@ sub builder { __END__ -=encoding utf8 - =head1 SOURCE The source code repository for Test::More can be found at diff --git a/cpan/Test-Simple/lib/Test/Builder/Tester.pm b/cpan/Test-Simple/lib/Test/Builder/Tester.pm index 324f91e56d..8762147c70 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.301001_097'; +our $VERSION = '1.301001_098'; $VERSION = eval $VERSION; ## no critic (BuiltinFunctions::ProhibitStringyEval) use Test::Stream 1.301001 '-internal'; @@ -9,6 +9,10 @@ use Test::Builder 1.301001; use Symbol; use Test::Stream::Carp qw/croak/; +=pod + +=encoding UTF-8 + =head1 NAME Test::Builder::Tester - *DEPRECATED* test testsuites that have been built with @@ -465,8 +469,6 @@ me use his testing system to try this module out on. L<Test::Builder>, L<Test::Builder::Tester::Color>, L<Test::More>. -=encoding utf8 - =head1 SOURCE The source code repository for Test::More can be found at diff --git a/cpan/Test-Simple/lib/Test/Builder/Tester/Color.pm b/cpan/Test-Simple/lib/Test/Builder/Tester/Color.pm index 4a1accfba5..675a86a25f 100644 --- a/cpan/Test-Simple/lib/Test/Builder/Tester/Color.pm +++ b/cpan/Test-Simple/lib/Test/Builder/Tester/Color.pm @@ -1,12 +1,15 @@ package Test::Builder::Tester::Color; use strict; -our $VERSION = '1.301001_097'; +our $VERSION = '1.301001_098'; $VERSION = eval $VERSION; ## no critic (BuiltinFunctions::ProhibitStringyEval) use Test::Stream 1.301001 '-internal'; require Test::Builder::Tester; +=pod + +=encoding UTF-8 =head1 NAME @@ -54,8 +57,6 @@ L<Test::Builder::Tester>, L<Term::ANSIColor> __END__ -=encoding utf8 - =head1 SOURCE The source code repository for Test::More can be found at diff --git a/cpan/Test-Simple/lib/Test/FAQ.pod b/cpan/Test-Simple/lib/Test/FAQ.pod index 232ec99b26..770984a8c5 100644 --- a/cpan/Test-Simple/lib/Test/FAQ.pod +++ b/cpan/Test-Simple/lib/Test/FAQ.pod @@ -1,3 +1,7 @@ +=pod + +=encoding UTF-8 + =head1 NAME Test::FAQ - Frequently Asked Questions about testing with Perl @@ -376,8 +380,6 @@ not do any testing. It simply returns true or false. Use the following code... # Now you can use the testing function. print is_deeply( "foo", "bar" ) ? "Yes" : "No"; -=encoding utf8 - =head1 SOURCE The source code repository for Test::More can be found at diff --git a/cpan/Test-Simple/lib/Test/More.pm b/cpan/Test-Simple/lib/Test/More.pm index df11bc5d41..8b812acf23 100644 --- a/cpan/Test-Simple/lib/Test/More.pm +++ b/cpan/Test-Simple/lib/Test/More.pm @@ -4,7 +4,7 @@ use 5.008001; use strict; use warnings; -our $VERSION = '1.301001_097'; +our $VERSION = '1.301001_098'; $VERSION = eval $VERSION; ## no critic (BuiltinFunctions::ProhibitStringyEval) use Test::Stream 1.301001 '-internal'; @@ -393,6 +393,10 @@ sub use_ok($;@) { __END__ +=pod + +=encoding UTF-8 + =head1 NAME Test::More - The defacto standard in unit testing tools. @@ -1742,8 +1746,6 @@ L<Bundle::Test> installs a whole bunch of useful test modules. L<Test::Most> Most commonly needed test functions and features. -=encoding utf8 - =head1 SOURCE The source code repository for Test::More can be found at diff --git a/cpan/Test-Simple/lib/Test/More/DeepCheck.pm b/cpan/Test-Simple/lib/Test/More/DeepCheck.pm index 4ec03fa2bf..0f9ae9a95b 100644 --- a/cpan/Test-Simple/lib/Test/More/DeepCheck.pm +++ b/cpan/Test-Simple/lib/Test/More/DeepCheck.pm @@ -108,6 +108,10 @@ sub format_stack { __END__ +=pod + +=encoding UTF-8 + =head1 NAME Test::More::DeepCheck - Base class or is_deeply() and mostly_like() @@ -122,8 +126,6 @@ code shared betweent he 2 tools. Most of this was refactored from the original C<is_deeply()> implementation. If you find any bugs or incompatabilities please report them. -=encoding utf8 - =head1 SOURCE The source code repository for Test::More can be found at diff --git a/cpan/Test-Simple/lib/Test/More/DeepCheck/Strict.pm b/cpan/Test-Simple/lib/Test/More/DeepCheck/Strict.pm index d50e9801ea..5ac69e8809 100644 --- a/cpan/Test-Simple/lib/Test/More/DeepCheck/Strict.pm +++ b/cpan/Test-Simple/lib/Test/More/DeepCheck/Strict.pm @@ -217,6 +217,10 @@ sub _check_hash { __END__ +=pod + +=encoding UTF-8 + =head1 NAME Test::More::DeepCheck::Strict - Where is_deeply() is implemented. @@ -227,8 +231,6 @@ This is the package where the code for C<is_deeply()> from L<Test::More> lives. This code was refactored into this form, but should remain 100% compatible with the old implementation. If you find an incompatability please report it. -=encoding utf8 - =head1 SOURCE The source code repository for Test::More can be found at diff --git a/cpan/Test-Simple/lib/Test/More/DeepCheck/Tolerant.pm b/cpan/Test-Simple/lib/Test/More/DeepCheck/Tolerant.pm index ef3fb4505f..793b4c05a7 100644 --- a/cpan/Test-Simple/lib/Test/More/DeepCheck/Tolerant.pm +++ b/cpan/Test-Simple/lib/Test/More/DeepCheck/Tolerant.pm @@ -220,6 +220,10 @@ sub _hash_check { __END__ +=pod + +=encoding UTF-8 + =head1 NAME Test::More::DeepCheck::Tolerant - Under the hood implementation of @@ -229,8 +233,6 @@ mostly_like() This is where L<Test::MostlyLike> is implemented. -=encoding utf8 - =head1 SOURCE The source code repository for Test::More can be found at diff --git a/cpan/Test-Simple/lib/Test/More/Tools.pm b/cpan/Test-Simple/lib/Test/More/Tools.pm index 554b3d90b9..1fea46f0e2 100644 --- a/cpan/Test-Simple/lib/Test/More/Tools.pm +++ b/cpan/Test-Simple/lib/Test/More/Tools.pm @@ -17,6 +17,19 @@ sub tmt() { __PACKAGE__ } my %CMP_OK_BL = map { ( $_, 1 ) } ( "=", "+=", ".=", "x=", "^=", "|=", "||=", "&&=", "..."); my %NUMERIC_CMPS = map { ( $_, 1 ) } ( "<", "<=", ">", ">=", "==", "!=", "<=>" ); +sub _cmp_eval { + my ($line, $name, $file, $got, $type, $expect) = @_; + my $test; + # This is so that warnings come out at the caller's level + ## no critic (BuiltinFunctions::ProhibitStringyEval) + eval qq[ +#line $line "(eval in $name) $file" +\$test = (\$got $type \$expect); +1; + ] || die $@; + return $test; +} + sub cmp_check { my($class, $got, $type, $expect) = @_; @@ -31,13 +44,7 @@ sub cmp_check { my $test = 0; my ($success, $error) = try { - # This is so that warnings come out at the caller's level - ## no critic (BuiltinFunctions::ProhibitStringyEval) - eval qq[ -#line $line "(eval in $name) $file" -\$test = (\$got $type \$expect); -1; - ] || die $@; + $test = _cmp_eval($line, $name, $file, $got, $type, $expect); }; my @diag; @@ -326,6 +333,10 @@ DIAGNOSTIC __END__ +=pod + +=encoding UTF-8 + =head1 NAME Test::More::Tools - Generic form of tools from Test::More. @@ -396,8 +407,6 @@ Regex compare. C<$op> may be C<=~> or C<!~>. =back -=encoding utf8 - =head1 SOURCE The source code repository for Test::More can be found at diff --git a/cpan/Test-Simple/lib/Test/MostlyLike.pm b/cpan/Test-Simple/lib/Test/MostlyLike.pm index 76c6c470d8..88316094a9 100644 --- a/cpan/Test-Simple/lib/Test/MostlyLike.pm +++ b/cpan/Test-Simple/lib/Test/MostlyLike.pm @@ -36,6 +36,9 @@ WARNING 1; __END__ +=pod + +=encoding UTF-8 =head1 NAME @@ -189,8 +192,6 @@ Sometimes you want to ignore the methods and get the hash value directly. mostly_like($got, $exp, "Did not call the fatal method"); -=encoding utf8 - =head1 SOURCE The source code repository for Test::More can be found at diff --git a/cpan/Test-Simple/lib/Test/Simple.pm b/cpan/Test-Simple/lib/Test/Simple.pm index b3de80e8de..3ab569324d 100644 --- a/cpan/Test-Simple/lib/Test/Simple.pm +++ b/cpan/Test-Simple/lib/Test/Simple.pm @@ -5,10 +5,10 @@ use 5.008001; use strict; use warnings; -our $VERSION = '1.301001_097'; +our $VERSION = '1.301001_098'; $VERSION = eval $VERSION; ## no critic (BuiltinFunctions::ProhibitStringyEval) -use Test::Stream 1.301001_097 '-internal'; +use Test::Stream 1.301001_098 '-internal'; use Test::Stream::Toolset; use Test::Stream::Exporter; @@ -61,6 +61,10 @@ sub ok ($;$) { ## no critic (Subroutines::ProhibitSubroutinePrototypes) __END__ +=pod + +=encoding UTF-8 + =head1 NAME Test::Simple - Basic utilities for writing tests. @@ -234,9 +238,6 @@ programs and things will still work). Look in L<Test::More>'s SEE ALSO for more testing modules. - -=encoding utf8 - =head1 SOURCE The source code repository for Test::More can be found at diff --git a/cpan/Test-Simple/lib/Test/Stream.pm b/cpan/Test-Simple/lib/Test/Stream.pm index 799b553878..1c05f1d75f 100644 --- a/cpan/Test-Simple/lib/Test/Stream.pm +++ b/cpan/Test-Simple/lib/Test/Stream.pm @@ -2,7 +2,7 @@ package Test::Stream; use strict; use warnings; -our $VERSION = '1.301001_097'; +our $VERSION = '1.301001_098'; $VERSION = eval $VERSION; ## no critic (BuiltinFunctions::ProhibitStringyEval) use Test::Stream::Context qw/context/; @@ -404,7 +404,8 @@ sub done_testing { return; } - $ctx->plan($num || $plan || $ran) unless $state->[STATE_PLAN]; + # Use _plan to bypass Test::Builder::plan() monkeypatching + $ctx->_plan($num || $plan || $ran) unless $state->[STATE_PLAN]; if ($plan && $plan != $ran) { $state->[STATE_PASSING] = 0; @@ -743,6 +744,10 @@ sub STORABLE_thaw { __END__ +=pod + +=encoding UTF-8 + =head1 NAME Test::Stream - A modern infrastructure for testing. @@ -1080,8 +1085,6 @@ restored to the previous state. =back -=encoding utf8 - =head1 SOURCE The source code repository for Test::More can be found at diff --git a/cpan/Test-Simple/lib/Test/Stream/API.pm b/cpan/Test-Simple/lib/Test/Stream/API.pm index 68b1e558d1..0253081ac1 100644 --- a/cpan/Test-Simple/lib/Test/Stream/API.pm +++ b/cpan/Test-Simple/lib/Test/Stream/API.pm @@ -116,6 +116,10 @@ sub get_tap_outputs { __END__ +=pod + +=encoding UTF-8 + =head1 NAME Test::Stream::API - Single point of access to Test::Stream extendability @@ -533,10 +537,17 @@ already a tester it will return the existing meta-object. =item $context = context() +=item $context = context($add_level) + This will get the correct L<Test::Stream::Context> object. This may be one that was previously initialized, or it may generate a new one. Read the L<Test::Stream::Context> documentation for more info. +Note, C<context()> assumes you are at the lowest level of your tool, and looks +at the current caller. If you need it to look further you can call it with a +numeric argument which is added to the level. To clarify, calling C<context()> +is the same as calling C<context(0)>. + =item $stream = current_stream() This will return the current L<Test::Stream> Object. L<Test::Stream> objects @@ -586,8 +597,6 @@ Check if the test state is passing. =back -=encoding utf8 - =head1 SOURCE The source code repository for Test::More can be found at diff --git a/cpan/Test-Simple/lib/Test/Stream/Architecture.pod b/cpan/Test-Simple/lib/Test/Stream/Architecture.pod index b67fe7e0c6..84aec128bf 100644 --- a/cpan/Test-Simple/lib/Test/Stream/Architecture.pod +++ b/cpan/Test-Simple/lib/Test/Stream/Architecture.pod @@ -1,3 +1,7 @@ +=pod + +=encoding UTF-8 + =head1 NAME Test::Stream::Architecture - overview of how the Test-More dist works. @@ -350,8 +354,6 @@ Test::Stream, and then all events get intercepted by that subtest. When the subtest is done, issue another Child event to close it out. Once closed, a Subtest event will be generated for you and sent to the stream. -=encoding utf8 - =head1 SOURCE The source code repository for Test::More can be found at diff --git a/cpan/Test-Simple/lib/Test/Stream/ArrayBase.pm b/cpan/Test-Simple/lib/Test/Stream/ArrayBase.pm index 1be55694f0..6ac75de373 100644 --- a/cpan/Test-Simple/lib/Test/Stream/ArrayBase.pm +++ b/cpan/Test-Simple/lib/Test/Stream/ArrayBase.pm @@ -97,6 +97,10 @@ sub to_hash { __END__ +=pod + +=encoding UTF-8 + =head1 NAME Test::Stream::ArrayBase - Base class for classes that use an arrayref instead @@ -270,8 +274,6 @@ beyond reason. A large part of the slowdown was due to the use of proper methods instead of directly accessing elements. We also switched to using a LOT more objects that have methods. -=encoding utf8 - =head1 SOURCE The source code repository for Test::More can be found at diff --git a/cpan/Test-Simple/lib/Test/Stream/ArrayBase/Meta.pm b/cpan/Test-Simple/lib/Test/Stream/ArrayBase/Meta.pm index a283afd550..159807cc93 100644 --- a/cpan/Test-Simple/lib/Test/Stream/ArrayBase/Meta.pm +++ b/cpan/Test-Simple/lib/Test/Stream/ArrayBase/Meta.pm @@ -119,6 +119,10 @@ sub add_accessors { __END__ +=pod + +=encoding UTF-8 + =head1 NAME Test::Stream::ArrayBase::Meta - Meta Object for ArrayBase objects. @@ -181,8 +185,6 @@ C<uc($name)> constant. =back -=encoding utf8 - =head1 SOURCE The source code repository for Test::More can be found at diff --git a/cpan/Test-Simple/lib/Test/Stream/Carp.pm b/cpan/Test-Simple/lib/Test/Stream/Carp.pm index 36a5ee8232..6ec6a1512f 100644 --- a/cpan/Test-Simple/lib/Test/Stream/Carp.pm +++ b/cpan/Test-Simple/lib/Test/Stream/Carp.pm @@ -15,6 +15,10 @@ Test::Stream::Exporter->cleanup; __END__ +=pod + +=encoding UTF-8 + =head1 NAME Test::Stream::Carp - Delayed Carp loader. @@ -41,8 +45,6 @@ See L<Carp> for details on each of these functions. =back -=encoding utf8 - =head1 SOURCE The source code repository for Test::More can be found at diff --git a/cpan/Test-Simple/lib/Test/Stream/Context.pm b/cpan/Test-Simple/lib/Test/Stream/Context.pm index d2aaf100c1..b4215dbdb2 100644 --- a/cpan/Test-Simple/lib/Test/Stream/Context.pm +++ b/cpan/Test-Simple/lib/Test/Stream/Context.pm @@ -462,6 +462,10 @@ sub AUTOLOAD { __END__ +=pod + +=encoding UTF-8 + =head1 NAME Test::Stream::Context - Object to represent a testing context. @@ -503,6 +507,11 @@ context matters a lot. If you want to store a context for later reference use the C<snapshot()> method to get a clone of it that is safe to store anywhere. +Note, C<context()> assumes you are at the lowest level of your tool, and looks +at the current caller. If you need it to look further you can call it with a +numeric argument which is added to the level. To clarify, calling C<context()> +is the same as calling C<context(0)>. + =back =head1 METHODS @@ -623,8 +632,6 @@ is a reliable way to set a global todo that effects any/all packages. =back -=encoding utf8 - =head1 SOURCE The source code repository for Test::More can be found at diff --git a/cpan/Test-Simple/lib/Test/Stream/Event.pm b/cpan/Test-Simple/lib/Test/Stream/Event.pm index e814205a5e..2080597ce3 100644 --- a/cpan/Test-Simple/lib/Test/Stream/Event.pm +++ b/cpan/Test-Simple/lib/Test/Stream/Event.pm @@ -80,6 +80,10 @@ sub subevents { } __END__ +=pod + +=encoding UTF-8 + =head1 NAME Test::Stream::Event - Base class for events @@ -301,8 +305,6 @@ The skip message if the event was generated via skip. =back -=encoding utf8 - =head1 SOURCE The source code repository for Test::More can be found at diff --git a/cpan/Test-Simple/lib/Test/Stream/Event/Bail.pm b/cpan/Test-Simple/lib/Test/Stream/Event/Bail.pm index 4164d55359..4b50c63f30 100644 --- a/cpan/Test-Simple/lib/Test/Stream/Event/Bail.pm +++ b/cpan/Test-Simple/lib/Test/Stream/Event/Bail.pm @@ -28,6 +28,10 @@ sub extra_details { __END__ +=pod + +=encoding UTF-8 + =head1 NAME Test::Stream::Event::Bail - Bailout! @@ -81,8 +85,6 @@ Boolean, true if the bailout should be quiet. =back -=encoding utf8 - =head1 SOURCE The source code repository for Test::More can be found at diff --git a/cpan/Test-Simple/lib/Test/Stream/Event/Diag.pm b/cpan/Test-Simple/lib/Test/Stream/Event/Diag.pm index 0e12c0ccff..365a9868cb 100644 --- a/cpan/Test-Simple/lib/Test/Stream/Event/Diag.pm +++ b/cpan/Test-Simple/lib/Test/Stream/Event/Diag.pm @@ -13,7 +13,12 @@ use Test::Stream::Carp qw/confess/; sub init { $_[0]->SUPER::init(); - $_[0]->[MESSAGE] = 'undef' unless defined $_[0]->[MESSAGE]; + if (defined $_[0]->[MESSAGE]) { + $_[0]->[MESSAGE] .= ""; + } + else { + $_[0]->[MESSAGE] = 'undef'; + } weaken($_[0]->[LINKED]) if $_[0]->[LINKED]; } @@ -48,12 +53,14 @@ sub extra_details { __END__ +=pod + +=encoding UTF-8 + =head1 NAME Test::Stream::Event::Diag - Diag event type -=encoding utf8 - =head1 DESCRIPTION Diagnostics messages, typically rendered to STDERR. diff --git a/cpan/Test-Simple/lib/Test/Stream/Event/Finish.pm b/cpan/Test-Simple/lib/Test/Stream/Event/Finish.pm index 2f181a9ee8..0617e5f72a 100644 --- a/cpan/Test-Simple/lib/Test/Stream/Event/Finish.pm +++ b/cpan/Test-Simple/lib/Test/Stream/Event/Finish.pm @@ -18,6 +18,10 @@ sub extra_details { __END__ +=pod + +=encoding UTF-8 + =head1 NAME Test::Stream::Event::Finish - The finish event type @@ -26,8 +30,6 @@ Test::Stream::Event::Finish - The finish event type Sent after testing is finished. -=encoding utf8 - =head1 SOURCE The source code repository for Test::More can be found at diff --git a/cpan/Test-Simple/lib/Test/Stream/Event/Note.pm b/cpan/Test-Simple/lib/Test/Stream/Event/Note.pm index 263b08c852..6d39548395 100644 --- a/cpan/Test-Simple/lib/Test/Stream/Event/Note.pm +++ b/cpan/Test-Simple/lib/Test/Stream/Event/Note.pm @@ -11,7 +11,12 @@ use Test::Stream::Carp qw/confess/; sub init { $_[0]->SUPER::init(); - $_[0]->[MESSAGE] = 'undef' unless defined $_[0]->[MESSAGE]; + if (defined $_[0]->[MESSAGE]) { + $_[0]->[MESSAGE] .= ""; + } + else { + $_[0]->[MESSAGE] = 'undef'; + } } sub to_tap { @@ -33,12 +38,14 @@ sub extra_details { __END__ +=pod + +=encoding UTF-8 + =head1 NAME Test::Stream::Event::Note - Note event type -=encoding utf8 - =head1 DESCRIPTION Notes, typically rendered to STDOUT. diff --git a/cpan/Test-Simple/lib/Test/Stream/Event/Ok.pm b/cpan/Test-Simple/lib/Test/Stream/Event/Ok.pm index 2390638d8e..e4e9c03368 100644 --- a/cpan/Test-Simple/lib/Test/Stream/Event/Ok.pm +++ b/cpan/Test-Simple/lib/Test/Stream/Event/Ok.pm @@ -200,12 +200,14 @@ sub extra_details { __END__ +=pod + +=encoding UTF-8 + =head1 NAME Test::Stream::Event::Ok - Ok event type -=encoding utf8 - =head1 DESCRIPTION Ok events are generated whenever you run a test that produces a result. diff --git a/cpan/Test-Simple/lib/Test/Stream/Event/Plan.pm b/cpan/Test-Simple/lib/Test/Stream/Event/Plan.pm index 7467b99c98..f3712b2ca5 100644 --- a/cpan/Test-Simple/lib/Test/Stream/Event/Plan.pm +++ b/cpan/Test-Simple/lib/Test/Stream/Event/Plan.pm @@ -65,12 +65,14 @@ sub extra_details { __END__ +=pod + +=encoding UTF-8 + =head1 NAME Test::Stream::Event::Plan - The event of a plan -=encoding utf8 - =head1 DESCRIPTION Plan events are fired off whenever a plan is declared, done testing is called, diff --git a/cpan/Test-Simple/lib/Test/Stream/Event/Subtest.pm b/cpan/Test-Simple/lib/Test/Stream/Event/Subtest.pm index ce6ec32ac7..13ae97ef7d 100644 --- a/cpan/Test-Simple/lib/Test/Stream/Event/Subtest.pm +++ b/cpan/Test-Simple/lib/Test/Stream/Event/Subtest.pm @@ -124,6 +124,10 @@ sub extra_details { __END__ +=pod + +=encoding UTF-8 + =head1 NAME Test::Stream::Event::Subtest - Subtest event @@ -194,8 +198,6 @@ Number of tests that failed inside the subtest. =back -=encoding utf8 - =head1 SOURCE The source code repository for Test::More can be found at diff --git a/cpan/Test-Simple/lib/Test/Stream/ExitMagic.pm b/cpan/Test-Simple/lib/Test/Stream/ExitMagic.pm index 7f5bf5bccf..791ba14f6e 100644 --- a/cpan/Test-Simple/lib/Test/Stream/ExitMagic.pm +++ b/cpan/Test-Simple/lib/Test/Stream/ExitMagic.pm @@ -153,6 +153,10 @@ sub be_helpful_magic { __END__ +=pod + +=encoding UTF-8 + =head1 NAME Test::Stream::ExitMagic - Encapsulate the magic exit logic @@ -165,8 +169,6 @@ It's magic! well kinda.. Don't use this yourself, let L<Test::Stream> handle it. -=encoding utf8 - =head1 SOURCE The source code repository for Test::More can be found at diff --git a/cpan/Test-Simple/lib/Test/Stream/ExitMagic/Context.pm b/cpan/Test-Simple/lib/Test/Stream/ExitMagic/Context.pm index babad93608..9832a68a2c 100644 --- a/cpan/Test-Simple/lib/Test/Stream/ExitMagic/Context.pm +++ b/cpan/Test-Simple/lib/Test/Stream/ExitMagic/Context.pm @@ -19,6 +19,10 @@ sub from_end_block { 1 }; __END__ +=pod + +=encoding UTF-8 + =head1 NAME Test::Stream::ExitMagic::Context - Special context for use in an END block. @@ -32,8 +36,6 @@ trivial one is used instead. B<DO NOT USE THIS>. If you find yourself thinking that you should use this then B<STOP!> because you are very likely to be wrong. -=encoding utf8 - =head1 SOURCE The source code repository for Test::More can be found at diff --git a/cpan/Test-Simple/lib/Test/Stream/Explanation.pod b/cpan/Test-Simple/lib/Test/Stream/Explanation.pod new file mode 100644 index 0000000000..9314bb68b0 --- /dev/null +++ b/cpan/Test-Simple/lib/Test/Stream/Explanation.pod @@ -0,0 +1,943 @@ +package Test::Stream::Explanation; + +=pod + +=encoding UTF-8 + +=head1 NAME + +Test::Stream::Explanation - Explanation of all things Test::Stream + +=head1 Summary of problems the new internals solve + +=over 4 + +=item Monolithic singleton + +=item Subtests are a horrible hack + +=item No event monitoring/munging + +=item Diags and Oks are not linked + +=item $Level is fragile, non-obvious, and actively harmful + +=item Depth ($Level) is a bad thing to test against + +=item There is no good way to validate testing tools, only mediocre ways + +=item Cannot reuse Test::More tools without generating TAP + +=item TAP is mandatory + +=item Setting the encoding requires major hackery + +=item No forking support + +=item Shared variable hackery in thread support + +=back + +=head1 Solutions + +=head2 Singleton + +The biggest problem with Test::Builder is that it does 2 things at once. The +first thing it does is synchronization, which is accomplished by making it a +singleton. The second thing it does is provide a collection of useful tools and +shortcuts for generating events. This is an issue because the tools are tied to +the singleton, Subclassing Test::Builder is not an option, and there are few +hooks. You essentially have to hack the Test::Builder object, and hope nobody +else does the same. + +Test::Stream now houses synchronization code, all events come to Test::Stream, +which makes sure the state is updated, and then forwards the events to where +they need to be, including producing the TAP output. This module synchronizes +state, threads, processes, and events. + +Unlike Test::Builder, Test::Stream is not a true singleton. Test::Stream has a +singleton stack, and code always uses the instance at the top of the stack. +This allows you to temporarily push an instance to the top in order to +intercept events. + +Anything not essential to synchronization is kept in other modules. This model +allows you to subclass tools as you see fit. You can create and destroy +instances as needed. You can create your own toolboxes without accounting for +the nature of a singleton. + +=head2 Subtests + +Do not read the subtest implementation in the legacy Test::Builder code, if +your eyes bleed that much you won't be able to finish reading this document. +They first copy the singleton, then reset the originals internals, do their +thing, then restore the original internals. This is not an attack against the +people that wrote it; they did the best that could be done with the singleton +they had to work with. The only way to write a better implementation is to move +away from the monolithic singleton model. + +Subtests are now integrated into the design of Test::Stream. Test::Stream +maintains a state stack. When a subtest starts it pushes a new state to the top +of the stack, when it is finished it pops the state. Designing the internals +with subtests in mind from the beginning significantly reduces the hackery +necessary to make them work. + +Note: There is still some other stuff that makes subtests non-trivial, such as +TODO inheritance. But most of the problems related to subtests are solved in +much saner ways now. + +=head2 Event Handling + +In Test::Builder, ok, diag, note, etc. were all simply methods. You call the +method you get some TAP. There was no easy way to hook into the system and +modify an event. There is also no easy way to listen for events, or maintain a +complete list, short of parsing TAP. + +All "events" are now proper objects. Tools generate events such as 'ok' and +'diag', then send them to the Test::Stream instance at the top of the stack. +Test::Stream provides hooks for you to modify events before the test state is +updated, as well as hooks for reading/displaying/storing events after the state +is updated. There is also a hook for the end of the test run (done_testing, or +test ended). + +This is what Test::Stream is named Test::Stream, all events stream from the +tools into the Test::Stream funnel, which then gets them where they need to go. +Previously these kinds of actions required monkeypatching. + +=head2 Linking ok and diag + +Tools would typically call C<< $TB->ok >>, then call C<< $TB->diag >>. Both +would produce output. There is no easy way to associate the diag and the ok. +Often the messages can appear out of order, or far apart. Usually a human can +figure out what goes where, but connecting them programmatically is very hard +to do after the fact. + +Diags and oks can still exist as independent events, but by default all Test::More +tools link the 'ok' and 'diag' events they produce. This allows code to process +the ok and attached diagnostics as one unit. This prevents guess work +previously required to accomplish this. Any downstream tool can also link 'ok' +and 'diag' objects, but they are not required to do so for compatibility +reasons. + +NOTE: Once the events are turned into TAP they still have the same issue as +before, TAP itself does not provide any way of linking the diag and the ok. + +=head2 $Level + +=head3 Whats the problem with $Level? + + local $Test::Builder::Level = $Test::Builder::Level + $x; + +At a glance the code above seems reasonable... But there are caveats: + +=over 4 + +=item What if you have multiple Test::Builder instances? + +Don't + +=item What about subtests? + +$Level is zeroed out and restored later. + +=item What if my unit tests validate the value of $Level, but Test::Builder adds another layer? + +Test::Builder can never break large subs into small ones for this reason. Or +better yet, don't use Test::Tester since you have to jump through hoops for it +to skip testing level. + +=item This is a non-obvious interface for new perl developers. + +This code requires you to know about local, package variables, and scope. In +some cases you also need to do math, something better left to the computer. + +=back + +=head3 How is it solved? + +L<Test::Stream::Context> + +Instead of bumping $Level, you ask for a $context instance. You normally ask +for the $context at the shallowest level of your tools code. The context +figures out what file+line errors should be reported to, as well as recording +other critical per-test state such as TODO. + +Once you obtain a context, anything else that asks for the context will find +the one you already have. Once nothing is holding a reference to the context, a +new one can be generated. Essentially this lets the first tool in the stack +lock in a context, and all deeper tools find it. When your tool is finished the +Context is destroyed allowing the next tool to repeat the process. This lets +you stack tools arbitrarily without concerning yourself with depth value. + +Note: You can pass a level/depth value when obtaining a context if for some +reason you cannot obtain it at the shallowest level. + +Note: Context takes the value of $Level into account for compatibility reasons. +Backcompat like this adds an unfortunate level of complexity to Context. + +=head2 Validating test tools + +Test::Builder::Tester simply captures all output from Test::Builder. Your job +is to compare the strings it intercepts with the strings you expect. There are +a few helpers to reduce the tedious nature of these string compares, but +ultimately they are not very flexible. Changing the indentation of a comment +intended for human consumption can break any and all modules that use +Test::Builder::Tester. + +Test::Tester is a huge improvement, but lacks support for numerous features. +Test::Tester also works (worked) by replacing the singleton and monkeypatching +a lot of methods. Testing tools that also need to monkeypatch is not possible. +In addition it made too many assumptions about what you wanted to do with the +results it found. + +The solution here is Test::Stream::Tester. Test::Stream::Tester leverages the +stack nature of Test::Stream to intercept events generated over a specific +scope. These event objects can then be verified using well known tools from +Test::More, or the tools Test::Stream::Tester itself provides to make +validating events super easy. + +Another validation problem solved here is that you can filter, or be selective +about what events you care about. This allows you to test only the parts that +your module generates. This is helpful in ensuring changes upstream do not +break your tests unless they actually break your modules behavior. + +=head2 Resusable Test::More tools. + +Often people would write test subs that make use of tools such as C<like>, +C<is_deeply>, and others in a sequence to validate a single result. This +produces an 'ok' and/or diag for each tool used. In many cases people would +prefer to produce only a single final event, and a combined diagnostic message. +This is now possible. + +L<Test::More::Tools> and L<Test::More::DeepCheck> solve this problem. Nearly +all the internals of Test::More have been moved into these 2 modules. The subs +in these modules return a boolean and diagnostics messages, but do not fire off +events. These are then wrapped in Test::More to actually produce the events. +Using these tools you can create composite tools that produce a single event. + +L<Test::More::DeepCheck> is the base for is_deeply. This is useful because it +gives you a chance to create tools like is_deeply with similar diagnostics (for +better or worse). An example of this is L<Test::MostlyLike>. + +=head2 Mandatory TAP. + +99% of the time you want TAP. With the old internals turning TAP off was hard, +and usually resulted in a useless Test::Builder. + +There is now a single switch you can use to turn TAP on and off. The listener +feature of Test::Stream gives you the ability to produce whatever output you +desire for any event that comes along. All the test state is still kept +properly. + +=head2 Setting the encoding + +Legacy Test::Builder would clone the standard filehandles, reset them, and +modify them in various ways as soon as it loaded. Changes made to STDERR and +STDOUT after this action would have no effect on Test::Builder. You could +modify/set/reset Test::Builders filehandles, but this was not obvious. Setting +the encoding of the handles in Test::Builder could also be dangerous as other +modules might have changes the handles. + +For compatibility reasons Test::Stream still has to do all the filehandle +manipulation Test::Builder did. However it encapsulates it better and makes it +significantly easier to modify. Every class that produces events gets a +meta-object. The meta-object has an option for encoding. You can ask for a +specific encoding when you load Test::More, or you can change it at any point +in the test. + +Encodings are managed by <Test::Stream::IOSets>. Each Test::Stream instance has +an instance of L<Test::Stream::IOSets>. The default encoding is called 'legacy' +and it does what Test::Builder has always done. You can ask for a specific +encoding, such as utf8, and IOSets will create a new clone of STDERR and STDOUT +and handle setting the encoding for you. IOSets can manage several encodings +all at once, so you can switch as necessary in your tests, or have multiple +tests under the same process that use different encodings. + +=head2 Threads and Forking + +Legacy Test::Builder does not support producing results from multiple threads +without serious hacking or questionable third party modules (Of which I own +one, and help maintain another). + +Legacy Test::Builder does support threading, but only if threads are loaded +first. It uses shared variables and locking to maintain the test state and +ensure test numbers are consistent. + +Test::Stream has forking support baked in (though you have to ask for it). +Thread support has been changed to use the same mechanism as forking support. +There are no shared variables. Test::Stream implements checks to ensure that +all events generated get funneled to the parent process/thread where they can +then be properly processed. + +=head1 Module justifications + +All code is a liability. Any module which is included in the dist requires +some justification. If there is no justification for including the module the +sensible thing to do would be to purge it. + +=head2 Test::Builder + +Required for legacy support and backwards compatibility. + +=head2 Test::Builder::Module + +Required for legacy support and backwards compatibility. In the past people +were urged to use this as a base class for all testing tools. To my knowledge +adoption was very low. + +=head2 Test::Builder::Tester + +Has been included for many years. Tightly coupled with the rest of the testing +tools. Wide adoption. + +=head3 Additional components + +=over 4 + +=item Test::Builder::Tester::Color + +=back + +=head2 Test::CanFork + +Encapsulation of some logic that used to be duplicated in several Test-Simple +tests. Now usable by anyone. + +This module lets you make a test conditional upon support for forking. + +=head2 Test::CanThread + +Encapsulation of some logic that used to be duplicated in several Test-Simple +tests. Now usable by anyone. + +This module lets you make a test conditional upon support for threads. + +=head2 Test::More + +This requires no justification. + +=head3 Additional components + +=over 4 + +=item Test::More::DeepCheck + +This is a base class for tools that resemble is_deeply. A lot of this is +valuable logic that is now reusable. + +=item Test::More::DeepCheck::Strict + +This is the subclass that implements is_Deeply itself. I will not that this was +a refactor, not a re-implementation, there should be zero net-change to how +is_deeply behaves. + +=item Test::More::Tools + +This is where the guts of Test::More tools live. This is here so that they can +be reused in composite tests without any hacking. This was a refactor, not +redesign from the ground up. + +=back + +=head2 Test::MostlyLike + +This implements a new tool similar to is_deeply called mostly_like. This is +included in the dist because I wrote it specifically to test the Test-Simple +internals. It is also useful enough to publish publicly. + +=head3 Additional components + +=over 4 + +=item Test::More::DeepCheck::Tolerant + +This is the subclass that implements mostly_like. + +=back + +=head2 Test::Simple + +This requires no justification. This is also the module the dist is named after. + +=head2 Test::Stream + +This is the new crux of Test-Simple. + +Test::Stream is the hub to which all events flow. It is also responsible for +ensuring all events get to the correct place. This is where all synchronization +happens. + +=head3 Additional components + +=over 4 + +=item Test::Stream::API + +This is sugar-coating. This is the go-to place when people wish to know the +easiest way to accomplish something fancy. + +=item Test::Stream::Meta + +Metadata assigned to test files/packages + +=item Test::Stream::PackageUtil + +Utilities for inspecting package internals + +=item Test::Stream::Subtest + +Encapsulation of subtest logic + +=item Test::Stream::Threads + +Encapsulation of threading tools + +=item Test::Stream::Util + +Misc Utilities used all over Test-Simple + +=back + +=head2 Test::Stream::ArrayBase + +All objects in Test::Stream use this to generate methods and constructors. This +is done here, and the way it is, for performance. Before implementing this ans +switching to it, performance was bad enough to keep the new internals out of +core. + +=head3 Additional components + +=over 4 + +=item Test::Stream::ArrayBase::Meta + +=back + +=head2 Test::Stream::Block + +Subtests are typically codeblocks. This is an object to represent them. There +is some development in this module that will provide profoundly useful +debugging for subtests, though it has not yet been enabled. This module is in +the dist mainly to give it a shakedown and prove it before turning on the extra +debugging. + +=head2 Test::Stream::Carp + +We cannot load Carp until we actually need it, if we do it can cause unexpected +test passes downstream. This is one of few core modules I am willing to do this +for, mainly because legacy had the same policy. + +This module provides the same tools as Carp, they simple load Carp and call the +correct sub from there. + +=head2 Test::Stream::Context + +This module is responsible for gathering details about events that are to be +generated. It is responsible for figuring out where errors should be reported, +if we are in a TODO, and various other meta-data. + +This module is an essential module. + +It also handles backwards compatibility with $Level, $TODO, and +C<< Test::Builder->todo_start >>. + +=head2 Test::Stream::Event + +All 'events' are now proper objects, this is the base class for all events. + +=head3 Additional components + +=over 4 + +=item Test::Stream::Event::Bail + +Event for bailing out. + +=item Test::Stream::Event::Diag + +Event for diagnostics + +=item Test::Stream::Event::Finish + +Event for the end of the test. + +=item Test::Stream::Event::Note + +Event for notes. + +=item Test::Stream::Event::Ok + +The 'ok' event is the most well known. This is an essential event. + +=item Test::Stream::Event::Plan + +This event is triggered whenever a plan is declared. + +=item Test::Stream::Event::Subtest + +Subtests are their own event, it is a subclass of the +L<Test::Stream::Event::Ok> event. + +=back + +=head2 Test::Stream::ExitMagic + +This is where the magic that happens when a test process exists is +encapsulated. Some of this is pretty grody or questionable, nearly all of it is +here for legacy reasons. + +=head3 Additional components + +=over 4 + +=item Test::Stream::ExitMagic::Context + +Special Context object to use from ExitMagic. This is because a lot of Context +logic is a bad idea when run from an END block. + +=back + +=head2 Test::Stream::Exporter + +Test-Simple has to do a lot of exporting. Some of the exporting is not easy to +achieve using L<Exporter>. I can't use an export tool from cpan, so I had to +implement the bare minimum I needed here. + +=head3 Additional components + +=over 4 + +=item Test::Stream::Exporter::Meta + +=back + +=head2 Test::Stream::ForceExit + +This module is used to ensure that code exits by the end of a scope. This is +mainly for cases where you fork down stack from an eval and your code throws +and exception before it can exit. + +(A quick grep of the code tells me this is not in use anymore/yet. It can +probably be purged) + +=head2 Test::Stream::IOSets + +This is where filehandles and encodings are managed. This is here both to +implement legacy filehandle support, and to enable support for encodings. + +=head2 Test::Stream::Tester + +This module is intended to be the new and proper way to validate testing tools. +It supports all features of Test::Stream, and provides tools and helpers that +make the job easier. + +=head3 Additional components + +=over 4 + +=item Test::Stream::Tester::Checks + +=item Test::Stream::Tester::Checks::Event + +=item Test::Stream::Tester::Events + +=item Test::Stream::Tester::Events::Event + +=item Test::Stream::Tester::Grab + +=back + +=head2 Test::Stream::Toolset + +This module provides the minimum set of tools most test tools need to work. + +=head2 Test::Tester + +This is an important part of the ecosystem. It makes no sense to ship this +independently. Changes to Test-Simple can break this in any number of ways, +integration is the only sane option. + +=head3 Additional components + +Most of these remain for legacy support. + +=over 4 + +=item Test::Tester::Capture + +=item Test::Tester::CaptureRunner + +=item Test::Tester::Delegate + +=back + +=head2 Test::use::ok + +This module implements the sane companion to C<use_ok> which is C<use ok>. +There has been a desire to combine this into Test-Simple for years, I finally +did it. + +=head3 Additional components + +=over 4 + +=item ok + +This is where the actual implementation lives. + +=back + +=head1 Compatability Shims + +Some modules need to jump through extra hoops in order to support legacy code. +This section describes these instances. + +=head2 Test::Builder + +Nearly everything in this module is here purely for legacy and compatibility. +But there are some extra-notable items: + +=over 4 + +=item $_ORIG_Test + +=item %ORIG + +=item %WARNED + +These 3 variables are used to track and warn about changes to the singleton or +method monkeypatching that could cause problems. + +=item ctx() + +A special context method that does extra C<$Level> accounting. + +=item %TB15_METHODS + +=item AUTOLOAD + +Used to warn people when they appear to be using Test::Builder 1.5 methods that +never actually made it into production anywhere. + +=item underscore methods + +There are several private methods (underscore prefix) that were never intended +for external use. Despite underscores, warnings, and other such things people +used them externally anyway. Most were purged, but these were left because an +unbelievable amount of downstream things appear to depend on them. + +=back + +=head2 Test::Stream + +The state array has an extra field identified by the constant C<STATE_LEGACY>. +This is an array of all events of some types. Test::Builder used to maintain an +array of hashes representing events for inspection later. Code which relied on +this capability now depends on this and some translation logic in +Test::Builder. + +Unlike in old Test::Builder this feature can be turned off for performance and +memory improvement. + +=head2 Test::Stream::Util + +=over 4 + +=item is_dualvar + +Test::More has its own is_dualvar. This differs from Scalar::Utils dualvar +checker, enough to break cmp_ok. Because of the breakage I have not switched. + +=item is_regex + +Test::More tools check if things are regexes in many places. The way it does +this, and the things it considers to be regexes are suprising. Much of this is +due to VERY old code that might predate quick regexes. Switching away from this +would break a lot of things. + +=item unoverload + +Test::More has its own ideas of unoverloading things and when it is necessary. +Not safe to migrate away from this. + +=back + +=head2 Test::Stream::Context + +=over 4 + +=item TODO + +Has to look for todo in 4 places. $TODO in the test package, $TODO in +Test::More, the todo value of the Test::Builder singleton, and the todo in test +package meta-data. The main issue here is no good TODO system has ever been +found, so we use and support 4 mediocre or even bad ones. + +=item $Level + +Test::Builder has historically been very forgiving and clever when it comes to +$Level. Context takes $Level into account when finding the proper file + line +number for reporting errors. If $Level is wrong it attempts to be as forgiving +as Test::Builder was. Requiring $Level to be correct breaks an unfortunate +number of downstream tools, so we have to stay forgiving for now. + +=item Test::Builder monkeypatching + +When Test::Builder gets monkeypatched, we need to detect it here and try to +incorporate the monkeypatching. This is a horrible hack that works surprisingly +well. + +=item hide_todo + restore_todo + +Subtests need to hide the TODO state, they have always done this historically. +These methods accomplish this... for all 4 ways you can set TODO. + +=back + +=head2 Test::Stream::ExitMagic + +Test::Builder does a lot of stuff at exit. I would argue that a lot of this +should be harness logic. However compatibility and people relying on it means +we cannot just remove it all at once. + +This magic is called though either an END block, or done_testing. Sometimes +both. + +=head2 Test::Stream::IOSets + +Test::Builder clones STDERR and STDOUT and resets them to what it thinks they +should be. This encapsulates that logic and calls it 'legacy'. It then provides +mechanisms for actually supporting custom filehandles and encodings. + +=head2 Test::Tester + +This makes use of the STATE_LEGACY key mentioned in the Test::Stream section. +This also needs to do some gymnastics and monkeypatching for $Level support. + +=head1 Design Decisions + +=head2 Test::Builder + +Decided to turn this into a legacy wrapper. It is no longer essential for +anything new. + +=head2 Test::More + +Decided to refactor the logic out into reusable parts. No net change except for +some bug fixes. + +At one point some redesign was started, but it was abandoned, this mainly had +to do with use_ok and require_ok, which are horrible. + +=head3 Additional components + +Most logic was moved into these 3 modules + +=over 4 + +=item Test::More::DeepCheck + +is_deeply stack and diagnostics + +=item Test::More::DeepCheck::Strict + +is_deeply inner check functions + +=item Test::More::Tools + +Everything else. + +=back + +=head2 Test::Stream + +=over 4 + +=item Instead of a singleton, we have a stack of singletons + +We can't avoid using a singleton-like pattern when we are dealing with a shared +state. However there are times where we need to work around the singleton +model. The main example is writing tests for testing tools. The singleton stack +allows us to put new instances in place that will steal focus. + +Anything that produces events should send them to the topmost instance of +Test::Stream. Using tools like Test::Stream::Context and Test::Builder handle +this for you. + +In the old system you were expected to cache a copy of the Test::Builder +singleton, this caused problems when code needed to replace the singleton. +Subtests had to implement and ugly hack around this problem. In the new system +test state is also a stack, subtests work by pushing a new state, they do not +need to replace the entire singleton. + +=item Only state and synchronization is handled here + +Since this module is somewhat singleton in nature, we keep it as small as +possible. Anything that is put into a singleton-like object is hard to expand. +If it is not related to synchronization or common state, I tried to put it +somewhere else. + +=item Events are proper objects + +In the old design events were just methods that produced TAP. Now they are +proper objects that can be constructed, altered, passed around, etc. + +=item This module is a hub through which events stream + +Events are built by testing tools, once ready the events are given to +Test::Stream to ensure they get to the right place. + +=back + +=head2 Test::Stream::Meta + +Attaching meta-data to tests was a design decision adopted for settings that +people want, but might be different from test file to test file. Being able to +use different settings in different files is necessary for advanced testing +tools that might load multiple files at a time. Examples include Fennec, +Test::Class, etc. + +Currently TODO and tap_encoding are the only significant settings here. + +=head2 Test::Stream::ArrayBase + +This is the OO implementation used all over Test::Stream. The initial upgrade +to OO from a single object where hash elements were directly accessed resulted +in a significant slowdown. + +To avoid the slowdown a couple design decision were made: + +=over 4 + +=item Objects would be array based + +=item Constants would be used to access elements + +=item Single inheritance only for simplicity + +=item Seperate reader+writer methods + +=item generate methods for each attribute that use $_[xxx] and constants + +=back + +Together these designs resulted in huge performance gains. + +=head2 Test::Stream::Context + +The context object is created when a testing tool is called. Any testing tools +called within will find the existing context. This context stores important +things like test file, line number, etc. + +This is implemented as a weak singleton. When a tool gets a context is is +crated. When a tool returns the context is garbage collected and destroyed. +This allows the next tool to obtain a new context. + +=head2 Test::Stream::Event::Subtest + +The subtest event is a subclass of the ok event. This is done because a subtest +ultimately boils down to an 'ok'. + +=head2 Test::Stream::Exporter + +Test::Stream has to do some fancy exporting, specially due to +Test::Stream::ArrayBase and the attribute constants. This exporter is a very +light implementation modeled on Exporter::Declare. It uses a meta-object to +track exports. + +=head1 SOURCE + +The source code repository for Test::More can be found at +F<http://github.com/Test-More/test-more/>. + +=head1 MAINTAINER + +=over 4 + +=item Chad Granum E<lt>exodist@cpan.orgE<gt> + +=back + +=head1 AUTHORS + +The following people have all contributed to the Test-More dist (sorted using +VIM's sort function). + +=over 4 + +=item Chad Granum E<lt>exodist@cpan.orgE<gt> + +=item Fergal Daly E<lt>fergal@esatclear.ie>E<gt> + +=item Mark Fowler E<lt>mark@twoshortplanks.comE<gt> + +=item Michael G Schwern E<lt>schwern@pobox.comE<gt> + +=item 唐鳳 + +=back + +=head1 COPYRIGHT + +There has been a lot of code migration between modules, +here are all the original copyrights together: + +=over 4 + +=item Test::Stream + +=item Test::Stream::Tester + +Copyright 2014 Chad Granum E<lt>exodist7@gmail.comE<gt>. + +This program is free software; you can redistribute it and/or +modify it under the same terms as Perl itself. + +See F<http://www.perl.com/perl/misc/Artistic.html> + +=item Test::Simple + +=item Test::More + +=item Test::Builder + +Originally authored by Michael G Schwern E<lt>schwern@pobox.comE<gt> with much +inspiration from Joshua Pritikin's Test module and lots of help from Barrie +Slaymaker, Tony Bowden, blackstar.co.uk, chromatic, Fergal Daly and the perl-qa +gang. + +Idea by Tony Bowden and Paul Johnson, code by Michael G Schwern +E<lt>schwern@pobox.comE<gt>, wardrobe by Calvin Klein. + +Copyright 2001-2008 by Michael G Schwern E<lt>schwern@pobox.comE<gt>. + +This program is free software; you can redistribute it and/or +modify it under the same terms as Perl itself. + +See F<http://www.perl.com/perl/misc/Artistic.html> + +=item Test::use::ok + +To the extent possible under law, 唐鳳 has waived all copyright and related +or neighboring rights to L<Test-use-ok>. + +This work is published from Taiwan. + +L<http://creativecommons.org/publicdomain/zero/1.0> + +=item Test::Tester + +This module is copyright 2005 Fergal Daly <fergal@esatclear.ie>, some parts +are based on other people's work. + +Under the same license as Perl itself + +See http://www.perl.com/perl/misc/Artistic.html + +=item Test::Builder::Tester + +Copyright Mark Fowler E<lt>mark@twoshortplanks.comE<gt> 2002, 2004. + +This program is free software; you can redistribute it +and/or modify it under the same terms as Perl itself. + +=back diff --git a/cpan/Test-Simple/lib/Test/Stream/Exporter.pm b/cpan/Test-Simple/lib/Test/Stream/Exporter.pm index f02befd298..237560a330 100644 --- a/cpan/Test-Simple/lib/Test/Stream/Exporter.pm +++ b/cpan/Test-Simple/lib/Test/Stream/Exporter.pm @@ -132,6 +132,10 @@ sub default_exports { __END__ +=pod + +=encoding UTF-8 + =head1 NAME Test::Stream::Exporter - Declarative exporter for Test::Stream and friends. @@ -225,8 +229,6 @@ if the package has imported it. =head1 HOOKS -=encoding utf8 - =head1 SOURCE The source code repository for Test::More can be found at diff --git a/cpan/Test-Simple/lib/Test/Stream/Exporter/Meta.pm b/cpan/Test-Simple/lib/Test/Stream/Exporter/Meta.pm index 735a9afa9b..0bdf93533a 100644 --- a/cpan/Test-Simple/lib/Test/Stream/Exporter/Meta.pm +++ b/cpan/Test-Simple/lib/Test/Stream/Exporter/Meta.pm @@ -126,6 +126,10 @@ sub get { __END__ +=pod + +=encoding UTF-8 + =head1 NAME Test::Stream::Exporter::Meta - Meta object for exporters. @@ -134,8 +138,6 @@ Test::Stream::Exporter::Meta - Meta object for exporters. L<Test::Stream::Exporter> uses this package to manage exports. -=encoding utf8 - =head1 SOURCE The source code repository for Test::More can be found at diff --git a/cpan/Test-Simple/lib/Test/Stream/ForceExit.pm b/cpan/Test-Simple/lib/Test/Stream/ForceExit.pm index e32edfb8b4..32efb58170 100644 --- a/cpan/Test-Simple/lib/Test/Stream/ForceExit.pm +++ b/cpan/Test-Simple/lib/Test/Stream/ForceExit.pm @@ -32,7 +32,7 @@ __END__ =head1 NAME -Test::ForceExit - Ensure C<exit()> is called bvy the end of a scope, force the issue. +Test::ForceExit - Ensure C<exit()> is called by the end of a scope, force the issue. =head1 DESCRIPTION diff --git a/cpan/Test-Simple/lib/Test/Stream/IOSets.pm b/cpan/Test-Simple/lib/Test/Stream/IOSets.pm index e2352efec5..c76b6755c7 100644 --- a/cpan/Test-Simple/lib/Test/Stream/IOSets.pm +++ b/cpan/Test-Simple/lib/Test/Stream/IOSets.pm @@ -108,6 +108,10 @@ sub _apply_layers { __END__ +=pod + +=encoding UTF-8 + =head1 NAME Test::Stream::IOSets - Manage sets of IO Handles in specific encodings. @@ -142,8 +146,6 @@ encoding. =back -=encoding utf8 - =head1 SOURCE The source code repository for Test::More can be found at diff --git a/cpan/Test-Simple/lib/Test/Stream/Meta.pm b/cpan/Test-Simple/lib/Test/Stream/Meta.pm index 9f7b6d38c3..68e6641deb 100644 --- a/cpan/Test-Simple/lib/Test/Stream/Meta.pm +++ b/cpan/Test-Simple/lib/Test/Stream/Meta.pm @@ -38,6 +38,10 @@ sub init_tester { __END__ +=pod + +=encoding UTF-8 + =head1 NAME Test::Stream::Meta - Meta object for unit test packages. @@ -101,8 +105,6 @@ These are various attributes stored on the meta object. =back -=encoding utf8 - =head1 SOURCE The source code repository for Test::More can be found at diff --git a/cpan/Test-Simple/lib/Test/Stream/PackageUtil.pm b/cpan/Test-Simple/lib/Test/Stream/PackageUtil.pm index f2a2a8c2de..03a82487f2 100644 --- a/cpan/Test-Simple/lib/Test/Stream/PackageUtil.pm +++ b/cpan/Test-Simple/lib/Test/Stream/PackageUtil.pm @@ -73,6 +73,10 @@ sub package_purge_sym { __END__ +=pod + +=encoding UTF-8 + =head1 NAME Test::Stream::PackageUtil - Utils for manipulating package symbol tables. @@ -107,8 +111,6 @@ name of the symbol to remove. =back -=encoding utf8 - =head1 SOURCE The source code repository for Test::More can be found at diff --git a/cpan/Test-Simple/lib/Test/Stream/Subtest.pm b/cpan/Test-Simple/lib/Test/Stream/Subtest.pm index 06016d268d..97e274eaeb 100644 --- a/cpan/Test-Simple/lib/Test/Stream/Subtest.pm +++ b/cpan/Test-Simple/lib/Test/Stream/Subtest.pm @@ -105,6 +105,10 @@ This is almost certainly not what you wanted. Did you fork and forget to exit? __END__ +=pod + +=encoding UTF-8 + =head1 Name Test::Stream::Subtest - Encapsulate subtest start, run, and finish. @@ -115,8 +119,6 @@ Test::Stream::Subtest - Encapsulate subtest start, run, and finish. subtest $name => sub { ... }; -=encoding utf8 - =head1 SOURCE The source code repository for Test::More can be found at diff --git a/cpan/Test-Simple/lib/Test/Stream/Tester.pm b/cpan/Test-Simple/lib/Test/Stream/Tester.pm index 91e9781f0d..111dc73f55 100644 --- a/cpan/Test-Simple/lib/Test/Stream/Tester.pm +++ b/cpan/Test-Simple/lib/Test/Stream/Tester.pm @@ -171,6 +171,10 @@ sub events_are { __END__ +=pod + +=encoding UTF-8 + =head1 NAME Test::Stream::Tester - Tools for validating the events produced by your testing @@ -624,8 +628,6 @@ The original test tester, checks TAP output as giant strings. =back -=encoding utf8 - =head1 SOURCE The source code repository for Test::More can be found at diff --git a/cpan/Test-Simple/lib/Test/Stream/Tester/Checks.pm b/cpan/Test-Simple/lib/Test/Stream/Tester/Checks.pm index 9321fe8f2c..d032807c13 100644 --- a/cpan/Test-Simple/lib/Test/Stream/Tester/Checks.pm +++ b/cpan/Test-Simple/lib/Test/Stream/Tester/Checks.pm @@ -285,6 +285,10 @@ sub filter_types { __END__ +=pod + +=encoding UTF-8 + =head1 NAME Test::Stream::Tester::Checks - Representation of a L<Test::Stream::Tester> @@ -300,8 +304,6 @@ B<Note:> The API for this object is not published and is subject to change. No b compatability can be guarenteed if you use this object directly. Please only use this object in the published way specified in L<Test::Stream::Tester>. -=encoding utf8 - =head1 SOURCE The source code repository for Test::More can be found at diff --git a/cpan/Test-Simple/lib/Test/Stream/Tester/Checks/Event.pm b/cpan/Test-Simple/lib/Test/Stream/Tester/Checks/Event.pm index 84517aacd9..649b3e75e2 100644 --- a/cpan/Test-Simple/lib/Test/Stream/Tester/Checks/Event.pm +++ b/cpan/Test-Simple/lib/Test/Stream/Tester/Checks/Event.pm @@ -82,6 +82,11 @@ sub validate_check { } 1; +__END__ + +=pod + +=encoding UTF-8 =head1 NAME @@ -93,8 +98,6 @@ specification. Used internally by L<Test::Stream::Tester>. Please do not use directly. No backwords compatability will be provided if the API for this module changes. -=encoding utf8 - =head1 SOURCE The source code repository for Test::More can be found at diff --git a/cpan/Test-Simple/lib/Test/Stream/Tester/Events.pm b/cpan/Test-Simple/lib/Test/Stream/Tester/Events.pm index 36ee93ec64..529fdee408 100644 --- a/cpan/Test-Simple/lib/Test/Stream/Tester/Events.pm +++ b/cpan/Test-Simple/lib/Test/Stream/Tester/Events.pm @@ -32,6 +32,11 @@ sub clone { } 1; +__END__ + +=pod + +=encoding UTF-8 =head1 NAME @@ -65,8 +70,6 @@ Clone the events list object in its current state. =back -=encoding utf8 - =head1 SOURCE The source code repository for Test::More can be found at diff --git a/cpan/Test-Simple/lib/Test/Stream/Tester/Events/Event.pm b/cpan/Test-Simple/lib/Test/Stream/Tester/Events/Event.pm index f4265ad830..0c3e2063f8 100644 --- a/cpan/Test-Simple/lib/Test/Stream/Tester/Events/Event.pm +++ b/cpan/Test-Simple/lib/Test/Stream/Tester/Events/Event.pm @@ -54,6 +54,11 @@ sub debug { } 1; +__END__ + +=pod + +=encoding UTF-8 =head1 NAME @@ -98,8 +103,6 @@ which it was generated. =back -=encoding utf8 - =head1 SOURCE The source code repository for Test::More can be found at diff --git a/cpan/Test-Simple/lib/Test/Stream/Tester/Grab.pm b/cpan/Test-Simple/lib/Test/Stream/Tester/Grab.pm index bf2ab5ffcc..8022011024 100644 --- a/cpan/Test-Simple/lib/Test/Stream/Tester/Grab.pm +++ b/cpan/Test-Simple/lib/Test/Stream/Tester/Grab.pm @@ -57,6 +57,8 @@ __END__ =pod +=encoding UTF-8 + =head1 NAME Test::Stream::Tester::Grab - Object used to temporarily steal all events. @@ -114,8 +116,6 @@ Get an arrayref of all the events, then destroy the grab object. =back -=encoding utf8 - =head1 SOURCE The source code repository for Test::More can be found at diff --git a/cpan/Test-Simple/lib/Test/Stream/Threads.pm b/cpan/Test-Simple/lib/Test/Stream/Threads.pm index e07c9cea6f..2a90c6b119 100644 --- a/cpan/Test-Simple/lib/Test/Stream/Threads.pm +++ b/cpan/Test-Simple/lib/Test/Stream/Threads.pm @@ -28,6 +28,10 @@ Test::Stream::Exporter->cleanup; __END__ +=pod + +=encoding UTF-8 + =head1 NAME Test::Stream::Threads - Tools for using threads with Test::Stream. @@ -62,8 +66,6 @@ otherwise it returns 0. =back -=encoding utf8 - =head1 SOURCE The source code repository for Test::More can be found at diff --git a/cpan/Test-Simple/lib/Test/Stream/Toolset.pm b/cpan/Test-Simple/lib/Test/Stream/Toolset.pm index 1a2ad03f71..c13086a090 100644 --- a/cpan/Test-Simple/lib/Test/Stream/Toolset.pm +++ b/cpan/Test-Simple/lib/Test/Stream/Toolset.pm @@ -61,6 +61,11 @@ Test::Stream::Exporter->cleanup(); 1; +__END__ + +=pod + +=encoding UTF-8 =head1 NAME @@ -315,8 +320,6 @@ complete. See L<Test::Stream::Tester>. This library gives you all the tools you need to test your testing tools. -=encoding utf8 - =head1 SOURCE The source code repository for Test::More can be found at diff --git a/cpan/Test-Simple/lib/Test/Stream/Util.pm b/cpan/Test-Simple/lib/Test/Stream/Util.pm index 60325a3814..79b8087f6a 100644 --- a/cpan/Test-Simple/lib/Test/Stream/Util.pm +++ b/cpan/Test-Simple/lib/Test/Stream/Util.pm @@ -165,6 +165,7 @@ sub is_dualvar($) { # Objects are not dualvars. return 0 if ref $val; + return 0 unless defined $val; no warnings 'numeric'; my $numval = $val + 0; @@ -215,6 +216,10 @@ sub translate_filename { __END__ +=pod + +=encoding UTF-8 + =head1 NAME Test::Stream::Util - Tools used by Test::Stream and friends. @@ -276,8 +281,6 @@ specified, encoding. =back -=encoding utf8 - =head1 SOURCE The source code repository for Test::More can be found at diff --git a/cpan/Test-Simple/lib/Test/Tester.pm b/cpan/Test-Simple/lib/Test/Tester.pm index 22a8c96c02..5ac4b58796 100644 --- a/cpan/Test-Simple/lib/Test/Tester.pm +++ b/cpan/Test-Simple/lib/Test/Tester.pm @@ -16,7 +16,7 @@ require Exporter; use vars qw( @ISA @EXPORT $VERSION ); -our $VERSION = '1.301001_097'; +our $VERSION = '1.301001_098'; $VERSION = eval $VERSION; ## no critic (BuiltinFunctions::ProhibitStringyEval) @EXPORT = qw( run_tests check_tests check_test cmp_results show_space ); @@ -320,6 +320,10 @@ sub _export_to_level { __END__ +=pod + +=encoding UTF-8 + =head1 NAME Test::Tester - *DEPRECATED* Ease testing test modules built with Test::Builder @@ -669,8 +673,6 @@ captures the strings output by Test::Builder. This means you cannot get separate access to the individual pieces of information and you must predict B<exactly> what your test will output. -=encoding utf8 - =head1 SOURCE The source code repository for Test::More can be found at diff --git a/cpan/Test-Simple/lib/Test/Tester/Capture.pm b/cpan/Test-Simple/lib/Test/Tester/Capture.pm index d63fc8d556..0fd9f90c4b 100644 --- a/cpan/Test-Simple/lib/Test/Tester/Capture.pm +++ b/cpan/Test-Simple/lib/Test/Tester/Capture.pm @@ -50,6 +50,10 @@ sub details { __END__ +=pod + +=encoding UTF-8 + =head1 NAME Test::Tester::Capture - Capture module for TesT::Tester @@ -58,8 +62,6 @@ Test::Tester::Capture - Capture module for TesT::Tester Legacy support for Test::Tester. -=encoding utf8 - =head1 SOURCE The source code repository for Test::More can be found at diff --git a/cpan/Test-Simple/lib/Test/Tutorial/WritingTests.pod b/cpan/Test-Simple/lib/Test/Tutorial/WritingTests.pod index 45713fbaad..9f367c067c 100644 --- a/cpan/Test-Simple/lib/Test/Tutorial/WritingTests.pod +++ b/cpan/Test-Simple/lib/Test/Tutorial/WritingTests.pod @@ -1,5 +1,7 @@ =pod +=encoding UTF-8 + =head1 NAME Test::Tutorial::WritingTests - A Complete Introduction to writing tests @@ -97,8 +99,6 @@ L<Test::More> See L<Test::Tutorial::WritingTools> -=encoding utf8 - =head1 SOURCE The source code repository for Test::More can be found at diff --git a/cpan/Test-Simple/lib/Test/Tutorial/WritingTools.pod b/cpan/Test-Simple/lib/Test/Tutorial/WritingTools.pod index 26f4d370a6..97c14d19ab 100644 --- a/cpan/Test-Simple/lib/Test/Tutorial/WritingTools.pod +++ b/cpan/Test-Simple/lib/Test/Tutorial/WritingTools.pod @@ -1,5 +1,7 @@ =pod +=encoding UTF-8 + =head1 NAME Test::Tutorial::WritingTools - How to write testing tools. @@ -105,6 +107,11 @@ sequence will get independant context objects. What this means is that you should NEVER store a context object in a package variable or object attribute. You should also never assign it to a variable in a higher scope. +C<context()> assumes you are at the lowest level of your tool, and looks at the +current caller. If you need it to look further you can call it with a numeric +argument which is added to the level. To clarify, calling C<context()> is the +same as calling C<context(0)>. + =head1 Nesting calls to other tools use Test::More; @@ -194,8 +201,6 @@ deprecated. They were once the way everyone tested their testers, but they do not allow you to test all events, and they are very fragile when upstream libs change. -=encoding utf8 - =head1 SOURCE The source code repository for Test::More can be found at diff --git a/cpan/Test-Simple/lib/Test/use/ok.pm b/cpan/Test-Simple/lib/Test/use/ok.pm index dabdd13777..c9e19ed720 100644 --- a/cpan/Test-Simple/lib/Test/use/ok.pm +++ b/cpan/Test-Simple/lib/Test/use/ok.pm @@ -3,7 +3,7 @@ use strict; use warnings; use 5.005; -our $VERSION = '1.301001_097'; +our $VERSION = '1.301001_098'; $VERSION = eval $VERSION; ## no critic (BuiltinFunctions::ProhibitStringyEval) use Test::Stream 1.301001 '-internal'; @@ -11,7 +11,9 @@ use Test::Stream 1.301001 '-internal'; 1; __END__ -=encoding utf8 +=pod + +=encoding UTF-8 =head1 NAME @@ -49,8 +51,6 @@ makes it clear that this is a single compile-time action. L<Test::More> -=encoding utf8 - =head1 SOURCE The source code repository for Test::More can be found at diff --git a/cpan/Test-Simple/lib/ok.pm b/cpan/Test-Simple/lib/ok.pm index 94e62401bc..653eb491a0 100644 --- a/cpan/Test-Simple/lib/ok.pm +++ b/cpan/Test-Simple/lib/ok.pm @@ -6,7 +6,7 @@ use Test::Stream 1.301001 '-internal'; use Test::More 1.301001 (); use Test::Stream::Carp qw/croak/; -our $VERSION = '1.301001_097'; +our $VERSION = '1.301001_098'; $VERSION = eval $VERSION; ## no critic (BuiltinFunctions::ProhibitStringyEval) sub import { @@ -25,7 +25,9 @@ sub import { __END__ -=encoding utf8 +=pod + +=encoding UTF-8 =head1 NAME @@ -42,8 +44,6 @@ and they will be executed at C<BEGIN> time. Please see L<Test::use::ok> for the full description. -=encoding utf8 - =head1 SOURCE The source code repository for Test::More can be found at diff --git a/cpan/Test-Simple/t/Behavior/MonkeyPatching_diag.t b/cpan/Test-Simple/t/Behavior/MonkeyPatching_diag.t index 2a62f68022..e89f02cc97 100644 --- a/cpan/Test-Simple/t/Behavior/MonkeyPatching_diag.t +++ b/cpan/Test-Simple/t/Behavior/MonkeyPatching_diag.t @@ -13,6 +13,7 @@ my $orig = Test::Builder->can('diag'); use Test::More; use Test::Stream; use Test::MostlyLike; + use Test::Stream::Tester qw/intercept/; no warnings 'redefine'; local *Test::Builder::diag = sub { @@ -29,8 +30,10 @@ my $orig = Test::Builder->can('diag'); my @warnings; { local $SIG{__WARN__} = sub { push @warnings => @_ }; - diag('first'); - diag('seconds'); + intercept { + diag('first'); + diag('seconds'); + }; } mostly_like( \@warnings, @@ -47,6 +50,7 @@ my $orig = Test::Builder->can('diag'); use Test::More; use Test::Stream; use Test::MostlyLike; + use Test::Stream::Tester qw/intercept/; no warnings 'redefine'; local *Test::Builder::diag = sub { @@ -63,8 +67,10 @@ my $orig = Test::Builder->can('diag'); my @warnings; { local $SIG{__WARN__} = sub { push @warnings => @_ }; - diag('first'); - diag('seconds'); + intercept { + diag('first'); + diag('seconds'); + }; } mostly_like( \@warnings, @@ -79,6 +85,7 @@ my $orig = Test::Builder->can('diag'); { package MyLegacyTester; use Test::More; + use Test::Stream::Tester qw/intercept/; no warnings 'redefine'; local *Test::Builder::diag = sub { @@ -90,8 +97,10 @@ my $orig = Test::Builder->can('diag'); my @warnings; { local $SIG{__WARN__} = sub { push @warnings => @_ }; - diag('first'); - diag('seconds'); + intercept { + diag('first'); + diag('seconds'); + }; } is(@warnings, 0, "no warnings for a legacy tester"); } diff --git a/cpan/Test-Simple/t/Behavior/MonkeyPatching_plan.t b/cpan/Test-Simple/t/Behavior/MonkeyPatching_plan.t index bec61caa6e..236a083cbf 100644 --- a/cpan/Test-Simple/t/Behavior/MonkeyPatching_plan.t +++ b/cpan/Test-Simple/t/Behavior/MonkeyPatching_plan.t @@ -4,7 +4,7 @@ use B; use Test::Stream; use Test::MostlyLike; -use Test::More tests => 6; +use Test::More tests => 8; use Test::Builder; # Not loaded by default in modern mode my $orig = Test::Builder->can('plan'); @@ -84,3 +84,32 @@ mostly_like( "Got the warning once" ); + + +no warnings 'redefine'; +*Test::Builder::plan = sub { }; +use warnings; +my $ok; +events_are( + intercept { + $ok = eval { + plan(tests => 1); + plan(tests => 2); + ok(1); + ok(1); + ok(1); + done_testing; + 1; + }; + }, + check { + event ok => { bool => 1 }; + event ok => { bool => 1 }; + event ok => { bool => 1 }; + event plan => { max => 3 }; + directive 'end'; + }, + "Make sure plan monkeypatching does not effect done_testing" +); + +ok($ok, "Did not die"); diff --git a/cpan/Test-Simple/t/Behavior/cmp_ok_undef.t b/cpan/Test-Simple/t/Behavior/cmp_ok_undef.t new file mode 100644 index 0000000000..1e317c55d1 --- /dev/null +++ b/cpan/Test-Simple/t/Behavior/cmp_ok_undef.t @@ -0,0 +1,19 @@ +use Test::More; +use strict; +use warnings; + +use Test::Stream::Tester; + +my @warnings; +local $SIG{__WARN__} = sub { push @warnings => @_ }; +my @events = intercept { cmp_ok( undef, '==', 6 ) }; + +is(@warnings, 1, "1 warning"); + +like( + $warnings[0], + qr/Use of uninitialized value .* at \(eval in cmp_ok\)/, + "Got the expected warning" +); + +done_testing; diff --git a/cpan/Test-Simple/t/Behavior/event_clone_args.t b/cpan/Test-Simple/t/Behavior/event_clone_args.t new file mode 100644 index 0000000000..7d4824d550 --- /dev/null +++ b/cpan/Test-Simple/t/Behavior/event_clone_args.t @@ -0,0 +1,22 @@ +use Test::More; +use strict; +use warnings; + +use B; +use Test::Stream::Tester qw/intercept/; + +my @events; + +my $x1 = \(my $y1); +push @events => intercept { note $x1 }; +is(B::svref_2object($x1)->REFCNT, 2, "Note does not store a ref"); + +my $x2 = \(my $y2); +push @events => intercept { diag $x2 }; +is(B::svref_2object($x2)->REFCNT, 2, "diag does not store a ref"); + +my $x3 = \(my $y3); +push @events => intercept { ok($x3, "Generating") }; +is(B::svref_2object($x3)->REFCNT, 2, "ok does not store a ref"); + +done_testing; diff --git a/cpan/Test-Simple/t/Behavior/skip_all_in_subtest.t b/cpan/Test-Simple/t/Behavior/skip_all_in_subtest.t index d4b12ce7db..5f8abea6a6 100644 --- a/cpan/Test-Simple/t/Behavior/skip_all_in_subtest.t +++ b/cpan/Test-Simple/t/Behavior/skip_all_in_subtest.t @@ -5,12 +5,23 @@ use warnings; use Test::More; +my @warnings; +local $SIG{__WARN__} = sub { push @warnings, $_[0] }; + subtest my_subtest1 => sub { my $file = __FILE__; $file =~ s/\.t$/1.load/; do $file; }; +is(scalar(@warnings), 1, "one warning"); +like( + $warnings[0], + qr/^SKIP_ALL in subtest via 'BEGIN' or 'use'/, + "the warning" +); + + subtest my_subtest2 => sub { my $file = __FILE__; $file =~ s/\.t$/2.load/; diff --git a/cpan/Test-Simple/t/Legacy/ribasushi_diag.t b/cpan/Test-Simple/t/Legacy/ribasushi_diag.t deleted file mode 100644 index 570ee5159b..0000000000 --- a/cpan/Test-Simple/t/Legacy/ribasushi_diag.t +++ /dev/null @@ -1,59 +0,0 @@ -use strict; -use warnings; - -use Test::More; - -BEGIN { - my $has_module = eval { require SQL::Abstract::Test; 1 }; - my $required = $ENV{AUTHOR_TESTING}; - - if ($required && !$has_module) { - die "This test requires 'SQL::Abstract::Test' to be installed when AUTHOR_TESTING.\n"; - } - - unless($required) { - plan skip_all => "Only run when AUTHOR_TESTING is set"; - } -} - -{ - package Worker; - - sub do_work { - local $Test::Builder::Level = $Test::Builder::Level + 2; - shift->(); - } -} - -use SQL::Abstract::Test; -use Test::Stream::Tester; - -my $events = intercept { - local $TODO = "Not today"; - - Worker::do_work( - sub { - SQL::Abstract::Test::is_same_sql_bind( - 'buh', [], - 'bah', [1], - ); - } - ); -}; - -ok( !(grep { $_->context->in_todo ? 0 : 1 } @{$events->[0]->diag}), "All diag is todo" ); - -events_are( - $events, - check { - event ok => { - in_todo => 1, - }; - event note => { in_todo => 1 }; - event note => { in_todo => 1 }; - dir 'end'; - }, - "All events are TODO" -); - -done_testing; diff --git a/cpan/Test-Simple/t/Legacy/subtest/basic.t b/cpan/Test-Simple/t/Legacy/subtest/basic.t index 5a0166d5db..92af4dc8f1 100644 --- a/cpan/Test-Simple/t/Legacy/subtest/basic.t +++ b/cpan/Test-Simple/t/Legacy/subtest/basic.t @@ -15,7 +15,7 @@ use warnings; use Test::Builder::NoOutput; -use Test::More tests => 16; +use Test::More tests => 18; # Formatting may change if we're running under Test::Harness. $ENV{HARNESS_ACTIVE} = 0; @@ -166,8 +166,18 @@ END my $tb = Test::Builder::NoOutput->create; { + my @warnings; + local $SIG{__WARN__} = sub { push @warnings, $_[0] }; + my $child = $tb->child('skippy says he loves you'); - eval { $child->plan( skip_all => 'cuz I said so' ) }; + eval { $child->plan(skip_all => 'cuz I said so') }; + + is(scalar(@warnings), 1, "one warning"); + like( + $warnings[0], + qr/^SKIP_ALL in subtest could not find flow-control label,/, + "the warning" + ); } subtest 'skip all', sub { plan skip_all => 'subtest with skip_all'; diff --git a/cpan/Test-Simple/t/Test-Stream-Event-Diag.t b/cpan/Test-Simple/t/Test-Stream-Event-Diag.t index 95ba48ea6e..d5297d2d15 100644 --- a/cpan/Test-Simple/t/Test-Stream-Event-Diag.t +++ b/cpan/Test-Simple/t/Test-Stream-Event-Diag.t @@ -3,6 +3,7 @@ use warnings; use Test::Stream; use Test::More; +use Test::Stream::Tester qw/intercept/; use ok 'Test::Stream::Event::Diag'; @@ -10,7 +11,8 @@ my $ctx = context(-1); my $line = __LINE__; $ctx = $ctx->snapshot; is($ctx->line, $line, "usable context"); -my $diag = $ctx->diag('hello'); +my $diag; +intercept { $diag = context()->diag('hello') }; ok($diag, "build diag"); isa_ok($diag, 'Test::Stream::Event::Diag'); is($diag->message, 'hello', "message"); diff --git a/cpan/Test-Simple/t/Test-Stream-ForceExit.t b/cpan/Test-Simple/t/Test-Stream-ForceExit.t index 6bae48c788..8596494fed 100644 --- a/cpan/Test-Simple/t/Test-Stream-ForceExit.t +++ b/cpan/Test-Simple/t/Test-Stream-ForceExit.t @@ -19,7 +19,7 @@ unless ($pid) { { my $force_exit = Test::Stream::ForceExit->new; - diag "In Child"; + note "In Child"; } print $write "Did not exit!"; @@ -48,7 +48,7 @@ unless ($pid) { { my $force_exit = Test::Stream::ForceExit->new; - diag "In Child $$"; + note "In Child $$"; $force_exit->done(1); } |