]> git.vpit.fr Git - perl/modules/VPIT-TestHelpers.git/commitdiff
Make diag() and skip_all() use Test::Leaner if it is loaded
authorVincent Pit <vince@profvince.com>
Fri, 7 Sep 2012 11:50:34 +0000 (13:50 +0200)
committerVincent Pit <vince@profvince.com>
Fri, 7 Sep 2012 11:50:34 +0000 (13:50 +0200)
lib/VPIT/TestHelpers.pm

index 591adf2182fd90d3f57feb9c56e857e080fe65f3..abee64079108f825b1be4d9d0138f6dccc5c9a03 100644 (file)
@@ -16,15 +16,23 @@ sub import {
  }
 }
 
-sub skip_all {
- my ($msg) = @_;
- require Test::More;
- Test::More::plan(skip_all => $msg);
-}
+my $test_sub = sub {
+ my $sub = shift;
+ my $stash;
+ if ($INC{'Test/Leaner.pm'}) {
+  $stash = \%Test::Leaner::;
+ } else {
+  require Test::More;
+  $stash = \%Test::More::;
+ }
+ return $stash->{$sub};
+};
+
+sub skip_all { $test_sub->('plan')->(skip_all => $_[0]) }
 
 sub diag {
require Test::More;
Test::More::diag($_) for @_;
my $diag = $test_sub->('diag');
$diag->($_) for @_;
 }
 
 our $TODO;