summaryrefslogtreecommitdiff
path: root/cpan/Test-Simple/t/regression
diff options
context:
space:
mode:
Diffstat (limited to 'cpan/Test-Simple/t/regression')
-rw-r--r--cpan/Test-Simple/t/regression/696-intercept_skip_all.t2
-rw-r--r--cpan/Test-Simple/t/regression/721-nested-streamed-subtest.t151
-rw-r--r--cpan/Test-Simple/t/regression/757-reset_in_subtest.t20
-rw-r--r--cpan/Test-Simple/t/regression/buffered_subtest_plan_buffered.t39
-rw-r--r--cpan/Test-Simple/t/regression/builder_does_not_init.t18
5 files changed, 155 insertions, 75 deletions
diff --git a/cpan/Test-Simple/t/regression/696-intercept_skip_all.t b/cpan/Test-Simple/t/regression/696-intercept_skip_all.t
index 1362e1046f..faa84a206d 100644
--- a/cpan/Test-Simple/t/regression/696-intercept_skip_all.t
+++ b/cpan/Test-Simple/t/regression/696-intercept_skip_all.t
@@ -29,7 +29,7 @@ tests no_eval => sub {
tests in_require => sub {
my $events = intercept {
- require 't/lib/SkipAll.pm';
+ require './t/lib/SkipAll.pm';
die "Should not see this: $@";
};
diff --git a/cpan/Test-Simple/t/regression/721-nested-streamed-subtest.t b/cpan/Test-Simple/t/regression/721-nested-streamed-subtest.t
index b97e0e6a03..a8a8287059 100644
--- a/cpan/Test-Simple/t/regression/721-nested-streamed-subtest.t
+++ b/cpan/Test-Simple/t/regression/721-nested-streamed-subtest.t
@@ -5,92 +5,95 @@ use Test2::Tools::Tiny;
# This module's exports interfere with the ones in t/tools.pl
use Test::More ();
+use Test::Builder::Formatter();
use Test2::API qw/run_subtest test2_stack/;
{
- test2_stack->top;
- my $temp_hub = test2_stack->new_hub();
+ test2_stack->top;
+ my $temp_hub = test2_stack->new_hub();
+ $temp_hub->format(Test::Builder::Formatter->new());
- my $output = capture {
- run_subtest(
- 'parent',
- sub {
- run_subtest(
- 'buffered',
- sub {
- ok(1, 'b1');
- ok(1, 'b2');
- },
- {buffered => 1},
- );
- run_subtest(
- 'streamed',
- sub {
- ok(1, 's1');
- ok(1, 's2');
- },
- {buffered => 0},
- );
- },
- {buffered => 1},
- );
- };
+ my $output = capture {
+ run_subtest(
+ 'parent',
+ sub {
+ run_subtest(
+ 'buffered',
+ sub {
+ ok(1, 'b1');
+ ok(1, 'b2');
+ },
+ {buffered => 1},
+ );
+ run_subtest(
+ 'streamed',
+ sub {
+ ok(1, 's1');
+ ok(1, 's2');
+ },
+ {buffered => 0},
+ );
+ },
+ {buffered => 1},
+ );
+ };
- test2_stack->pop($temp_hub);
+ test2_stack->pop($temp_hub);
- Test::More::subtest(
- 'Test2::API::run_subtest',
- sub {
- is($output->{STDERR}, q{}, 'no output on stderr');
- like($output->{STDOUT}, qr/ +ok 1 - b1/, 'got ok output for tests in buffered subtest');
- like($output->{STDOUT}, qr/ +ok 2 - b2/, 'got ok output for tests in buffered subtest');
- like($output->{STDOUT}, qr/ +ok 1 - s1/, 'got ok output for tests in streamed subtest');
- like($output->{STDOUT}, qr/ +ok 2 - s2/, 'got ok output for tests in streamed subtest');
- }
- );
+ Test::More::subtest(
+ 'Test2::API::run_subtest',
+ sub {
+ is($output->{STDERR}, q{}, 'no output on stderr');
+ like($output->{STDOUT}, qr/ +ok 1 - b1/, 'got ok output for tests in buffered subtest');
+ like($output->{STDOUT}, qr/ +ok 2 - b2/, 'got ok output for tests in buffered subtest');
+ like($output->{STDOUT}, qr/ +ok 1 - s1/, 'got ok output for tests in streamed subtest');
+ like($output->{STDOUT}, qr/ +ok 2 - s2/, 'got ok output for tests in streamed subtest');
+ }
+ );
}
{
- test2_stack->top;
- my $temp_hub = test2_stack->new_hub();
+ test2_stack->top;
+ my $temp_hub = test2_stack->new_hub();
+ $temp_hub->format(Test::Builder::Formatter->new());
- my $output = capture {
- run_subtest(
- 'parent',
- sub {
- run_subtest(
- 'buffered',
- sub {
- ok(1, 'b1');
- ok(1, 'b2');
- },
- {buffered => 1},
- );
- Test::More::subtest(
- 'streamed',
- sub {
- ok(1, 's1');
- ok(1, 's2');
- },
- {buffered => 0},
- );
- },
- {buffered => 1},
- );
- };
+ my $output = capture {
+ run_subtest(
+ 'parent',
+ sub {
+ run_subtest(
+ 'buffered',
+ sub {
+ ok(1, 'b1');
+ ok(1, 'b2');
+ },
+ {buffered => 1},
+ );
+ Test::More::subtest(
+ 'streamed',
+ sub {
+ ok(1, 's1');
+ ok(1, 's2');
+ },
+ {buffered => 0},
+ );
+ },
+ {buffered => 1},
+ );
+ };
- test2_stack->pop($temp_hub);
+ test2_stack->pop($temp_hub);
- Test::More::subtest(
- 'Test::More::subtest and Test2::API::run_subtest',
- sub {
- is($output->{STDERR}, q{}, 'no output on stderr');
- like($output->{STDOUT}, qr/ +ok 1 - b1/, 'got ok output for tests in buffered subtest');
- like($output->{STDOUT}, qr/ +ok 2 - b2/, 'got ok output for tests in buffered subtest');
- like($output->{STDOUT}, qr/ +ok 1 - s1/, 'got ok output for tests in streamed subtest');
- like($output->{STDOUT}, qr/ +ok 2 - s2/, 'got ok output for tests in streamed subtest');
- }
- );
+ Test::More::subtest(
+ 'Test::More::subtest and Test2::API::run_subtest',
+ sub {
+ is($output->{STDERR}, q{}, 'no output on stderr');
+ like($output->{STDOUT}, qr/ +ok 1 - b1/, 'got ok output for tests in buffered subtest');
+ like($output->{STDOUT}, qr/ +ok 2 - b2/, 'got ok output for tests in buffered subtest');
+ like($output->{STDOUT}, qr/ +ok 1 - s1/, 'got ok output for tests in streamed subtest');
+ like($output->{STDOUT}, qr/ +ok 2 - s2/, 'got ok output for tests in streamed subtest');
+ }
+ );
}
done_testing;
diff --git a/cpan/Test-Simple/t/regression/757-reset_in_subtest.t b/cpan/Test-Simple/t/regression/757-reset_in_subtest.t
new file mode 100644
index 0000000000..846a34d835
--- /dev/null
+++ b/cpan/Test-Simple/t/regression/757-reset_in_subtest.t
@@ -0,0 +1,20 @@
+use strict;
+use warnings;
+
+use Test::More;
+
+subtest 'subtest' => sub {
+ Test::Builder->new->reset;
+ ok 1;
+};
+
+subtest 'subtest' => sub {
+ Test::Builder->new->reset;
+ subtest 'subtest' => sub {
+ Test::Builder->new->reset;
+ ok 1;
+ };
+ ok 1;
+};
+
+done_testing;
diff --git a/cpan/Test-Simple/t/regression/buffered_subtest_plan_buffered.t b/cpan/Test-Simple/t/regression/buffered_subtest_plan_buffered.t
new file mode 100644
index 0000000000..e46697a23c
--- /dev/null
+++ b/cpan/Test-Simple/t/regression/buffered_subtest_plan_buffered.t
@@ -0,0 +1,39 @@
+use Test2::Tools::Tiny;
+use strict;
+use warnings;
+
+use Test2::API qw/intercept test2_stack/;
+use Data::Dumper;
+
+sub hide_buffered { 0 }
+
+sub write {
+ my $self = shift;
+ my ($e) = @_;
+
+ push @{$self->{events}} => $e;
+}
+
+sub finalize { }
+
+my $events;
+intercept {
+ my $hub = test2_stack()->top;
+ my $formatter = bless({}, __PACKAGE__);
+ $hub->format($formatter);
+ tests xxx => sub {
+ ok(1, "pass");
+ };
+
+ $events = $formatter->{events};
+};
+
+pop @$events;
+
+
+for my $e (@$events) {
+ ok($e->trace->buffered, "Buffered events are all listed as buffered") || diag(Dumper($e));
+}
+
+done_testing;
+
diff --git a/cpan/Test-Simple/t/regression/builder_does_not_init.t b/cpan/Test-Simple/t/regression/builder_does_not_init.t
new file mode 100644
index 0000000000..1f24ef2957
--- /dev/null
+++ b/cpan/Test-Simple/t/regression/builder_does_not_init.t
@@ -0,0 +1,18 @@
+use strict;
+use warnings;
+
+use Carp qw/confess/;
+use Test2::API::Instance;
+
+BEGIN {
+ no warnings 'redefine';
+ local *Test2::API::Instance::_finalize = sub { confess "_finalize called\n" };
+ local *Test2::API::Instance::load = sub { confess "load called\n" };
+
+ require Test::Builder;
+}
+
+use Test2::Tools::Tiny;
+
+ok(1, "Did not die");
+done_testing();