7 if ($^V ge v5.8.4 and $^V le v5.8.5) {
9 Test::More::plan(skip_all
10 => 'goto may segfault randomly on perl 5.8.4 and 5.8.5');
14 BEGIN { $ENV{PERL_TEST_LEANER_USES_TEST_MORE} = 1 }
20 if ($INC{'Test/More.pm'}) {
27 Test::More::plan(tests => 1 + 4 * 15 + 3 * 3 + 2 * 8);
28 Test::More::is($loaded, 1, 'Test::More has been loaded');
32 my ($stash, $name) = @_;
34 my $glob = $stash->{$name};
35 return undef unless $glob;
40 sub has_module_version {
41 my ($module, $version) = @_;
46 "$module"->VERSION(\$version);
51 sub has_test_more_version { has_module_version 'Test::More', @_ }
53 my $leaner_stash = \%Test::Leaner::;
54 my $more_stash = \%Test::More::;
55 my $this_stash = \%main::;
76 my $more_variant = get_subroutine($more_stash, $_);
78 my $leaner_variant = get_subroutine($leaner_stash, $_);
79 Test::More::ok(defined $leaner_variant,
80 "Test::Leaner variant of $_ is defined");
81 my $imported_variant = get_subroutine($this_stash, $_);
82 Test::More::ok(defined $imported_variant, "imported variant of $_ is defined");
85 Test::More::skip('Need leaner and imported variants to be defined' => 2)
86 unless defined $leaner_variant
87 and defined $imported_variant;
89 if (defined $more_variant) {
90 Test::More::is($leaner_variant, $more_variant,
91 "Test::Leaner variant of $_ is Test::More variant");
92 Test::More::is($imported_variant, $more_variant,
93 "imported variant of $_ is Test::More variant");
95 Test::More::is($imported_variant, $leaner_variant,
96 "imported variant of $_ is Test::Leaner variant");
99 eval { $leaner_variant->() };
100 Test::More::like($@, qr/^\Q$_\E is not implemented.*at \Q$0\E line \d+/,
101 "Test::Leaner of $_ variant croaks");
107 my @only_in_test_leaner = qw<
113 for (@only_in_test_leaner) {
114 Test::More::ok(exists $leaner_stash->{$_},
115 "$_ still exists in Test::Leaner");
116 Test::More::ok(!exists $more_stash->{$_},
117 "$_ was not imported into Test::More");
118 Test::More::ok(!exists $this_stash->{$_},
119 "$_ was not imported into main");
124 Test::More::skip('Test::More::plan exports stuff on Test::More <= 0.51'
125 => 2 * 8) unless has_test_more_version('0.51');
127 my @only_in_test_more = qw<
138 for (@only_in_test_more) {
139 my $more_variant = get_subroutine($more_stash, $_);
142 Test::More::skip("$_ is not implemented in this version of Test::More" => 2)
143 unless defined $more_variant;
145 Test::More::ok(!exists $leaner_stash->{$_},
146 "$_ was not imported into Test::Leaner");
147 Test::More::ok(!exists $this_stash->{$_},
148 "$_ was not imported into main");