Add 'no_test' import option to allow more composability
Arthur Axel 'fREW' Schmidt [Fri, 31 Jul 2015 04:49:50 +0000 (21:49 -0700)]
Changes
lib/Test/EOL.pm

diff --git a/Changes b/Changes
index cce7852..29129eb 100644 (file)
--- a/Changes
+++ b/Changes
@@ -1,5 +1,9 @@
 Revision history for Test-EOL
 
+{{$NEXT}}
+  - Add 'no_test' import option to allow more composability
+    (Arthur Axel fREW Schmidt)
+
 1.5 2012-09-08
   - Change to default to searching for trailing whitespace from the
     current directory downwards (as tests are run from the top of a dist
index 3c0ceea..860e427 100644 (file)
@@ -24,6 +24,8 @@ my %file_find_arg = ($] <= 5.006) ? () : (
 my $Test  = Test::Builder->new;
 my $updir = File::Spec->updir();
 
+my $no_plan;
+
 sub import {
     my $self   = shift;
     my $caller = caller;
@@ -33,6 +35,11 @@ sub import {
         *{$caller.'::all_perl_files_ok'} = \&all_perl_files_ok;
     }
     $Test->exported_to($caller);
+
+    if ($_[0] && $_[0] eq 'no_plan') {
+        shift;
+        $no_plan = 1;
+    }
     $Test->plan(@_);
 }
 
@@ -167,6 +174,7 @@ sub _module_to_path {
 }
 
 sub _make_plan {
+    return if $no_plan;
     unless ($Test->has_plan) {
         $Test->plan( 'no_plan' );
     }
@@ -215,6 +223,13 @@ or
   use Test::EOL;
   all_perl_files_ok({ trailing_whitespace => 1 }, @mydirs );
 
+or
+
+  use Test::More;
+  use Test::EOL 'no_test';
+  all_perl_files_ok();
+  done_testing;
+
 =head1 DESCRIPTION
 
 This module scans your project/distribution for any perl files (scripts,