X-Git-Url: http://git.vpit.fr/?p=perl%2Fmodules%2FTest-Leaner.git;a=blobdiff_plain;f=t%2F03-fallback.t;h=93129ae772ea48bc852bcadb1b528027665b4925;hp=3bda266c77e489ddc2cf5ac41a7c5060e75b7c28;hb=c5ef09dc0767113f5a35beeb4d4ce86bc84d774b;hpb=dee850ba2915663035bfd2b27b2d412e370f4a26 diff --git a/t/03-fallback.t b/t/03-fallback.t index 3bda266..93129ae 100644 --- a/t/03-fallback.t +++ b/t/03-fallback.t @@ -3,6 +3,14 @@ use strict; use warnings; +BEGIN { + if ($^V ge v5.8.4 and $^V le v5.8.5) { + require Test::More; + Test::More::plan(skip_all + => 'goto may segfault randomly on perl 5.8.4 and 5.8.5'); + } +} + BEGIN { $ENV{PERL_TEST_LEANER_USES_TEST_MORE} = 1 } use Test::Leaner; @@ -29,6 +37,19 @@ sub get_subroutine { return *$glob{CODE}; } +sub has_module_version { + my ($module, $version) = @_; + + local $@; + eval qq{ + require $module; + "$module"->VERSION(\$version); + 1; + } +} + +sub has_test_more_version { has_module_version 'Test::More', @_ } + my $leaner_stash = \%Test::Leaner::; my $more_stash = \%Test::More::; my $this_stash = \%main::; @@ -98,27 +119,33 @@ for (@only_in_test_leaner) { "$_ was not imported into main"); } -my @only_in_test_more = qw< - use_ok - require_ok - can_ok - isa_ok - new_ok - subtest - explain - todo_skip ->; - -for (@only_in_test_more) { - my $more_variant = get_subroutine($more_stash, $_); - - SKIP: { - Test::More::skip("$_ is not implemented in this version of Test::More" => 2) - unless defined $more_variant; - - Test::More::ok(!exists $leaner_stash->{$_}, - "$_ was not imported into Test::Leaner"); - Test::More::ok(!exists $this_stash->{$_}, - "$_ was not imported into main"); +SKIP: +{ + Test::More::skip('Test::More::plan exports stuff on Test::More <= 0.51' + => 2 * 8) unless has_test_more_version('0.51'); + + my @only_in_test_more = qw< + use_ok + require_ok + can_ok + isa_ok + new_ok + subtest + explain + todo_skip + >; + + for (@only_in_test_more) { + my $more_variant = get_subroutine($more_stash, $_); + + SKIP: { + Test::More::skip("$_ is not implemented in this version of Test::More" => 2) + unless defined $more_variant; + + Test::More::ok(!exists $leaner_stash->{$_}, + "$_ was not imported into Test::Leaner"); + Test::More::ok(!exists $this_stash->{$_}, + "$_ was not imported into main"); + } } }