Update Test-Simple to 1.302037
authorChad Granum <[email protected]>
Mon, 4 Jul 2016 19:36:02 +0000 (12:36 -0700)
committerJames E Keenan <[email protected]>
Mon, 4 Jul 2016 21:19:52 +0000 (17:19 -0400)
This includes many bugfixes and documentation updates.

This also fixes a notable bug where one test would pass under the
harness, but fail when run directly under perl (due to perl RT #128530)

For: RT #128536

47 files changed:
MANIFEST
cpan/Test-Simple/lib/Test/Builder.pm
cpan/Test-Simple/lib/Test/Builder/Formatter.pm
cpan/Test-Simple/lib/Test/Builder/Module.pm
cpan/Test-Simple/lib/Test/Builder/Tester.pm
cpan/Test-Simple/lib/Test/Builder/Tester/Color.pm
cpan/Test-Simple/lib/Test/Builder/TodoDiag.pm
cpan/Test-Simple/lib/Test/More.pm
cpan/Test-Simple/lib/Test/Simple.pm
cpan/Test-Simple/lib/Test/Tester.pm
cpan/Test-Simple/lib/Test/Tester/Capture.pm
cpan/Test-Simple/lib/Test/Tester/CaptureRunner.pm
cpan/Test-Simple/lib/Test/Tester/Delegate.pm
cpan/Test-Simple/lib/Test/use/ok.pm
cpan/Test-Simple/lib/Test2.pm
cpan/Test-Simple/lib/Test2/API.pm
cpan/Test-Simple/lib/Test2/API/Breakage.pm
cpan/Test-Simple/lib/Test2/API/Context.pm
cpan/Test-Simple/lib/Test2/API/Instance.pm
cpan/Test-Simple/lib/Test2/API/Stack.pm
cpan/Test-Simple/lib/Test2/Event.pm
cpan/Test-Simple/lib/Test2/Event/Bail.pm
cpan/Test-Simple/lib/Test2/Event/Diag.pm
cpan/Test-Simple/lib/Test2/Event/Exception.pm
cpan/Test-Simple/lib/Test2/Event/Generic.pm
cpan/Test-Simple/lib/Test2/Event/Note.pm
cpan/Test-Simple/lib/Test2/Event/Ok.pm
cpan/Test-Simple/lib/Test2/Event/Plan.pm
cpan/Test-Simple/lib/Test2/Event/Skip.pm
cpan/Test-Simple/lib/Test2/Event/Subtest.pm
cpan/Test-Simple/lib/Test2/Event/Waiting.pm
cpan/Test-Simple/lib/Test2/Formatter.pm
cpan/Test-Simple/lib/Test2/Formatter/TAP.pm
cpan/Test-Simple/lib/Test2/Hub.pm
cpan/Test-Simple/lib/Test2/Hub/Interceptor.pm
cpan/Test-Simple/lib/Test2/Hub/Interceptor/Terminator.pm
cpan/Test-Simple/lib/Test2/Hub/Subtest.pm
cpan/Test-Simple/lib/Test2/IPC.pm
cpan/Test-Simple/lib/Test2/IPC/Driver.pm
cpan/Test-Simple/lib/Test2/IPC/Driver/Files.pm
cpan/Test-Simple/lib/Test2/Util.pm
cpan/Test-Simple/lib/Test2/Util/ExternalMeta.pm
cpan/Test-Simple/lib/Test2/Util/HashBase.pm
cpan/Test-Simple/lib/Test2/Util/Trace.pm
cpan/Test-Simple/lib/ok.pm
cpan/Test-Simple/t/Legacy/subtest/plan.t [new file with mode: 0644]
cpan/Test-Simple/t/Test2/behavior/Subtest_plan.t [new file with mode: 0644]

index 68ed19d..bc863fe 100644 (file)
--- a/MANIFEST
+++ b/MANIFEST
@@ -2666,6 +2666,7 @@ cpan/Test-Simple/t/Legacy/subtest/for_do_t.test
 cpan/Test-Simple/t/Legacy/subtest/fork.t
 cpan/Test-Simple/t/Legacy/subtest/implicit_done.t
 cpan/Test-Simple/t/Legacy/subtest/line_numbers.t
+cpan/Test-Simple/t/Legacy/subtest/plan.t
 cpan/Test-Simple/t/Legacy/subtest/predicate.t
 cpan/Test-Simple/t/Legacy/subtest/singleton.t
 cpan/Test-Simple/t/Legacy/subtest/threads.t
@@ -2736,6 +2737,7 @@ cpan/Test-Simple/t/Test2/behavior/no_load_api.t
 cpan/Test-Simple/t/Test2/behavior/run_subtest_inherit.t
 cpan/Test-Simple/t/Test2/behavior/Subtest_buffer_formatter.t
 cpan/Test-Simple/t/Test2/behavior/Subtest_events.t
+cpan/Test-Simple/t/Test2/behavior/Subtest_plan.t
 cpan/Test-Simple/t/Test2/behavior/Taint.t
 cpan/Test-Simple/t/Test2/legacy/TAP.t
 cpan/Test-Simple/t/Test2/modules/API.t
index e04dd39..401cb3c 100644 (file)
@@ -4,7 +4,7 @@ use 5.006;
 use strict;
 use warnings;
 
-our $VERSION = '1.302035';
+our $VERSION = '1.302037';
 
 BEGIN {
     if( $] < 5.008 ) {
index 9b70d58..da09cb2 100644 (file)
@@ -2,7 +2,7 @@ package Test::Builder::Formatter;
 use strict;
 use warnings;
 
-our $VERSION = '1.302035';
+our $VERSION = '1.302037';
 
 BEGIN { require Test2::Formatter::TAP; our @ISA = qw(Test2::Formatter::TAP) }
 
index 72d7bea..b2db639 100644 (file)
@@ -7,7 +7,7 @@ use Test::Builder;
 require Exporter;
 our @ISA = qw(Exporter);
 
-our $VERSION = '1.302035';
+our $VERSION = '1.302037';
 
 
 =head1 NAME
index 1d93568..455ecf3 100644 (file)
@@ -1,7 +1,7 @@
 package Test::Builder::Tester;
 
 use strict;
-our $VERSION = '1.302035';
+our $VERSION = '1.302037';
 
 use Test::Builder;
 use Symbol;
index 43d833c..60be59a 100644 (file)
@@ -1,7 +1,7 @@
 package Test::Builder::Tester::Color;
 
 use strict;
-our $VERSION = '1.302035';
+our $VERSION = '1.302037';
 
 require Test::Builder::Tester;
 
index b319377..2726211 100644 (file)
@@ -2,7 +2,7 @@ package Test::Builder::TodoDiag;
 use strict;
 use warnings;
 
-our $VERSION = '1.302035';
+our $VERSION = '1.302037';
 
 BEGIN { require Test2::Event::Diag; our @ISA = qw(Test2::Event::Diag) }
 
index e0c2f84..7d69e72 100644 (file)
@@ -17,7 +17,7 @@ sub _carp {
     return warn @_, " at $file line $line\n";
 }
 
-our $VERSION = '1.302035';
+our $VERSION = '1.302037';
 
 use Test::Builder::Module;
 our @ISA    = qw(Test::Builder::Module);
index d0f9f06..bffc7e5 100644 (file)
@@ -4,7 +4,7 @@ use 5.006;
 
 use strict;
 
-our $VERSION = '1.302035';
+our $VERSION = '1.302037';
 
 use Test::Builder::Module;
 our @ISA    = qw(Test::Builder::Module);
index 88323f5..1d86981 100644 (file)
@@ -18,7 +18,7 @@ require Exporter;
 
 use vars qw( @ISA @EXPORT );
 
-our $VERSION = '1.302035';
+our $VERSION = '1.302037';
 
 @EXPORT = qw( run_tests check_tests check_test cmp_results show_space );
 @ISA = qw( Exporter );
index 3eb945f..d6a4c1c 100644 (file)
@@ -2,7 +2,7 @@ use strict;
 
 package Test::Tester::Capture;
 
-our $VERSION = '1.302035';
+our $VERSION = '1.302037';
 
 
 use Test::Builder;
index 03714fe..4a81f22 100644 (file)
@@ -3,7 +3,7 @@ use strict;
 
 package Test::Tester::CaptureRunner;
 
-our $VERSION = '1.302035';
+our $VERSION = '1.302037';
 
 
 use Test::Tester::Capture;
index 7659d6b..9ace7a0 100644 (file)
@@ -3,7 +3,7 @@ use warnings;
 
 package Test::Tester::Delegate;
 
-our $VERSION = '1.302035';
+our $VERSION = '1.302037';
 
 
 use vars '$AUTOLOAD';
index eca1f1c..1258906 100644 (file)
@@ -1,7 +1,7 @@
 package Test::use::ok;
 use 5.005;
 
-our $VERSION = '1.302035';
+our $VERSION = '1.302037';
 
 
 __END__
index 0ec3ddb..560bba4 100644 (file)
@@ -2,7 +2,7 @@ package Test2;
 use strict;
 use warnings;
 
-our $VERSION = '1.302035';
+our $VERSION = '1.302037';
 
 
 1;
index 27c17b3..31b0d0f 100644 (file)
@@ -2,7 +2,7 @@ package Test2::API;
 use strict;
 use warnings;
 
-our $VERSION = '1.302035';
+our $VERSION = '1.302037';
 
 
 my $INST;
index 75e9faa..049446d 100644 (file)
@@ -2,7 +2,7 @@ package Test2::API::Breakage;
 use strict;
 use warnings;
 
-our $VERSION = '1.302035';
+our $VERSION = '1.302037';
 
 
 use Test2::Util qw/pkg_to_file/;
index 64bc254..8281401 100644 (file)
@@ -2,7 +2,7 @@ package Test2::API::Context;
 use strict;
 use warnings;
 
-our $VERSION = '1.302035';
+our $VERSION = '1.302037';
 
 
 use Carp qw/confess croak longmess/;
index ca50fb9..712e193 100644 (file)
@@ -2,7 +2,7 @@ package Test2::API::Instance;
 use strict;
 use warnings;
 
-our $VERSION = '1.302035';
+our $VERSION = '1.302037';
 
 
 our @CARP_NOT = qw/Test2::API Test2::API::Instance Test2::IPC::Driver Test2::Formatter/;
index e699f03..fa85f62 100644 (file)
@@ -2,7 +2,7 @@ package Test2::API::Stack;
 use strict;
 use warnings;
 
-our $VERSION = '1.302035';
+our $VERSION = '1.302037';
 
 
 use Test2::Hub();
index db4f4df..1b0cac0 100644 (file)
@@ -2,7 +2,7 @@ package Test2::Event;
 use strict;
 use warnings;
 
-our $VERSION = '1.302035';
+our $VERSION = '1.302037';
 
 
 use Test2::Util::HashBase qw/trace nested in_subtest subtest_id/;
index 47d05a1..00e7ffc 100644 (file)
@@ -2,7 +2,7 @@ package Test2::Event::Bail;
 use strict;
 use warnings;
 
-our $VERSION = '1.302035';
+our $VERSION = '1.302037';
 
 
 BEGIN { require Test2::Event; our @ISA = qw(Test2::Event) }
index 5b3f685..e825d73 100644 (file)
@@ -2,7 +2,7 @@ package Test2::Event::Diag;
 use strict;
 use warnings;
 
-our $VERSION = '1.302035';
+our $VERSION = '1.302037';
 
 
 BEGIN { require Test2::Event; our @ISA = qw(Test2::Event) }
index a5f3071..70ace48 100644 (file)
@@ -2,7 +2,7 @@ package Test2::Event::Exception;
 use strict;
 use warnings;
 
-our $VERSION = '1.302035';
+our $VERSION = '1.302037';
 
 
 BEGIN { require Test2::Event; our @ISA = qw(Test2::Event) }
index 91cd9f3..78ec6df 100644 (file)
@@ -5,7 +5,7 @@ use warnings;
 use Carp qw/croak/;
 use Scalar::Util qw/reftype/;
 
-our $VERSION = '1.302035';
+our $VERSION = '1.302037';
 
 BEGIN { require Test2::Event; our @ISA = qw(Test2::Event) }
 use Test2::Util::HashBase;
index a0395fe..4e24e54 100644 (file)
@@ -2,7 +2,7 @@ package Test2::Event::Note;
 use strict;
 use warnings;
 
-our $VERSION = '1.302035';
+our $VERSION = '1.302037';
 
 
 BEGIN { require Test2::Event; our @ISA = qw(Test2::Event) }
index 386a86b..9ccd7cb 100644 (file)
@@ -2,7 +2,7 @@ package Test2::Event::Ok;
 use strict;
 use warnings;
 
-our $VERSION = '1.302035';
+our $VERSION = '1.302037';
 
 
 BEGIN { require Test2::Event; our @ISA = qw(Test2::Event) }
index a0bee2f..56b99f1 100644 (file)
@@ -2,7 +2,7 @@ package Test2::Event::Plan;
 use strict;
 use warnings;
 
-our $VERSION = '1.302035';
+our $VERSION = '1.302037';
 
 
 BEGIN { require Test2::Event; our @ISA = qw(Test2::Event) }
index 5b446ef..b1f9614 100644 (file)
@@ -2,7 +2,7 @@ package Test2::Event::Skip;
 use strict;
 use warnings;
 
-our $VERSION = '1.302035';
+our $VERSION = '1.302037';
 
 
 BEGIN { require Test2::Event::Ok; our @ISA = qw(Test2::Event::Ok) }
index 49b827f..28efaba 100644 (file)
@@ -2,7 +2,7 @@ package Test2::Event::Subtest;
 use strict;
 use warnings;
 
-our $VERSION = '1.302035';
+our $VERSION = '1.302037';
 
 
 BEGIN { require Test2::Event::Ok; our @ISA = qw(Test2::Event::Ok) }
index ee526bb..4fc5ed3 100644 (file)
@@ -2,7 +2,7 @@ package Test2::Event::Waiting;
 use strict;
 use warnings;
 
-our $VERSION = '1.302035';
+our $VERSION = '1.302037';
 
 
 BEGIN { require Test2::Event; our @ISA = qw(Test2::Event) }
index c4b0682..f83bb7c 100644 (file)
@@ -2,7 +2,7 @@ package Test2::Formatter;
 use strict;
 use warnings;
 
-our $VERSION = '1.302035';
+our $VERSION = '1.302037';
 
 
 my %ADDED;
index 900dae0..a610f45 100644 (file)
@@ -1,8 +1,9 @@
 package Test2::Formatter::TAP;
 use strict;
 use warnings;
+require PerlIO;
 
-our $VERSION = '1.302035';
+our $VERSION = '1.302037';
 
 
 use Test2::Util::HashBase qw{
@@ -108,8 +109,13 @@ sub write {
 sub _open_handles {
     my $self = shift;
 
-    open( my $out, '>&', STDOUT ) or die "Can't dup STDOUT:  $!";
-    open( my $err, '>&', STDERR ) or die "Can't dup STDERR:  $!";
+    my %seen;
+    open(my $out, '>&', STDOUT) or die "Can't dup STDOUT:  $!";
+    binmode($out, join(":", "", "raw", grep { $_ ne 'unix' and !$seen{$_}++ } PerlIO::get_layers(STDOUT)));
+
+    %seen = ();
+    open(my $err, '>&', STDERR) or die "Can't dup STDERR:  $!";
+    binmode($err, join(":", "", "raw", grep { $_ ne 'unix' and !$seen{$_}++ } PerlIO::get_layers(STDERR)));
 
     _autoflush($out);
     _autoflush($err);
index 40b6c19..89a04f0 100644 (file)
@@ -2,7 +2,7 @@ package Test2::Hub;
 use strict;
 use warnings;
 
-our $VERSION = '1.302035';
+our $VERSION = '1.302037';
 
 
 use Carp qw/carp croak confess/;
index 1b223dd..4e98aea 100644 (file)
@@ -2,7 +2,7 @@ package Test2::Hub::Interceptor;
 use strict;
 use warnings;
 
-our $VERSION = '1.302035';
+our $VERSION = '1.302037';
 
 
 use Test2::Hub::Interceptor::Terminator();
index 44a220a..00af99f 100644 (file)
@@ -2,7 +2,7 @@ package Test2::Hub::Interceptor::Terminator;
 use strict;
 use warnings;
 
-our $VERSION = '1.302035';
+our $VERSION = '1.302037';
 
 
 1;
index a11fc91..a050a75 100644 (file)
@@ -2,7 +2,7 @@ package Test2::Hub::Subtest;
 use strict;
 use warnings;
 
-our $VERSION = '1.302035';
+our $VERSION = '1.302037';
 
 
 BEGIN { require Test2::Hub; our @ISA = qw(Test2::Hub) }
index 01d3cd8..4ceed43 100644 (file)
@@ -2,7 +2,7 @@ package Test2::IPC;
 use strict;
 use warnings;
 
-our $VERSION = '1.302035';
+our $VERSION = '1.302037';
 
 
 use Test2::API::Instance;
index 5878d75..0df7b50 100644 (file)
@@ -2,7 +2,7 @@ package Test2::IPC::Driver;
 use strict;
 use warnings;
 
-our $VERSION = '1.302035';
+our $VERSION = '1.302037';
 
 
 use Carp qw/confess longmess/;
index acf0342..e7ff407 100644 (file)
@@ -2,7 +2,7 @@ package Test2::IPC::Driver::Files;
 use strict;
 use warnings;
 
-our $VERSION = '1.302035';
+our $VERSION = '1.302037';
 
 
 BEGIN { require Test2::IPC::Driver; our @ISA = qw(Test2::IPC::Driver) }
index b991727..49d0499 100644 (file)
@@ -2,7 +2,7 @@ package Test2::Util;
 use strict;
 use warnings;
 
-our $VERSION = '1.302035';
+our $VERSION = '1.302037';
 
 
 use Config qw/%Config/;
index c55196f..54d675b 100644 (file)
@@ -2,7 +2,7 @@ package Test2::Util::ExternalMeta;
 use strict;
 use warnings;
 
-our $VERSION = '1.302035';
+our $VERSION = '1.302037';
 
 
 use Carp qw/croak/;
index be76393..5b6d1e0 100644 (file)
@@ -2,7 +2,7 @@ package Test2::Util::HashBase;
 use strict;
 use warnings;
 
-our $VERSION = '1.302035';
+our $VERSION = '1.302037';
 
 
 require Carp;
index c5c7bec..3c20d90 100644 (file)
@@ -2,7 +2,7 @@ package Test2::Util::Trace;
 use strict;
 use warnings;
 
-our $VERSION = '1.302035';
+our $VERSION = '1.302037';
 
 
 use Test2::Util qw/get_tid/;
index d05feaf..ce019a7 100644 (file)
@@ -1,5 +1,5 @@
 package ok;
-$ok::VERSION = '1.302035';
+$ok::VERSION = '1.302037';
 
 use strict;
 use Test::More ();
diff --git a/cpan/Test-Simple/t/Legacy/subtest/plan.t b/cpan/Test-Simple/t/Legacy/subtest/plan.t
new file mode 100644 (file)
index 0000000..7e944ab
--- /dev/null
@@ -0,0 +1,49 @@
+#!/usr/bin/perl -w
+
+BEGIN {
+    if( $ENV{PERL_CORE} ) {
+        chdir 't';
+        @INC = ( '../lib', 'lib' );
+    }
+    else {
+        unshift @INC, 't/lib';
+    }
+}
+
+use strict;
+use warnings;
+
+use Test::Builder::NoOutput;
+
+use Test::More tests => 6;
+
+# Formatting may change if we're running under Test::Harness.
+$ENV{HARNESS_ACTIVE} = 0;
+
+{
+    ok defined &subtest, 'subtest() should be exported to our namespace';
+    is prototype('subtest'), undef, '... has no prototype';
+
+    subtest 'subtest with plan', sub {
+        plan tests => 2;
+        ok 1, 'planned subtests should work';
+        ok 1, '... and support more than one test';
+    };
+    subtest 'subtest without plan', sub {
+        plan 'no_plan';
+        ok 1, 'no_plan subtests should work';
+        ok 1, '... and support more than one test';
+        ok 1, '... no matter how many tests are run';
+    };
+    subtest 'subtest with implicit done_testing()', sub {
+        ok 1, 'subtests with an implicit done testing should work';
+        ok 1, '... and support more than one test';
+        ok 1, '... no matter how many tests are run';
+    };
+    subtest 'subtest with explicit done_testing()', sub {
+        ok 1, 'subtests with an explicit done testing should work';
+        ok 1, '... and support more than one test';
+        ok 1, '... no matter how many tests are run';
+        done_testing();
+    };
+}
diff --git a/cpan/Test-Simple/t/Test2/behavior/Subtest_plan.t b/cpan/Test-Simple/t/Test2/behavior/Subtest_plan.t
new file mode 100644 (file)
index 0000000..f3dab3c
--- /dev/null
@@ -0,0 +1,19 @@
+use strict;
+use warnings;
+
+BEGIN { require "t/tools.pl" };
+
+use Test2::API qw/run_subtest intercept/;
+
+my $events = intercept {
+    my $code = sub { plan 4; ok(1) };
+    run_subtest('bad_plan', $code, 'buffered');
+};
+
+is(
+    $events->[-1]->message,
+    "Bad subtest plan, expected 4 but ran 1",
+    "Helpful message if subtest has a bad plan",
+);
+
+done_testing;