[libdist-zilla-plugin-test-eol-perl] 10/13: add new "file" option

Intrigeri intrigeri at moszumanska.debian.org
Sun Aug 16 09:20:35 UTC 2015


This is an automated email from the git hooks/post-receive script.

intrigeri pushed a commit to annotated tag 0.17
in repository libdist-zilla-plugin-test-eol-perl.

commit cdf940280573deec74e0a3966bb1cb0af4771f53
Author: Karen Etheridge <ether at cpan.org>
Date:   Fri Jan 30 23:51:37 2015 -0800

    add new "file" option
---
 Changes                           |  1 +
 lib/Dist/Zilla/Plugin/Test/EOL.pm | 19 ++++++++++++++++++-
 t/03-finder.t                     |  8 +++++++-
 3 files changed, 26 insertions(+), 2 deletions(-)

diff --git a/Changes b/Changes
index 2d52d21..94d9beb 100644
--- a/Changes
+++ b/Changes
@@ -7,6 +7,7 @@ Revision history for {{$dist->name}}
           searching of .pod by default); also works around issue with older
           Test::EOL Test::NoTabs that tests nothing when the test is two levels
           deep from the dist root (see RT#66177)
+        - add new 'file' option, for adding additional files to test
 
 0.16    2014-11-17 03:00:59Z
         - allow tests to pass even while upstream modules have warnings under
diff --git a/lib/Dist/Zilla/Plugin/Test/EOL.pm b/lib/Dist/Zilla/Plugin/Test/EOL.pm
index f6d73de..c6649f7 100644
--- a/lib/Dist/Zilla/Plugin/Test/EOL.pm
+++ b/lib/Dist/Zilla/Plugin/Test/EOL.pm
@@ -36,10 +36,21 @@ has filename => (
     default => sub { return 'xt/author/eol.t' },
 );
 
+has files => (
+    isa => 'ArrayRef[Str]',
+    traits => ['Array'],
+    handles => { files => 'elements' },
+    lazy => 1,
+    default => sub { [] },
+);
+
 has _file_obj => (
     is => 'rw', isa => role_type('Dist::Zilla::Role::File'),
 );
 
+sub mvp_multivalue_args { 'files' }
+sub mvp_aliases { return { file => 'files' } }
+
 around dump_config => sub
 {
     my ($orig, $self) = @_;
@@ -76,6 +87,7 @@ sub munge_files
     my @filenames = map { path($_->name)->relative('.')->stringify }
         grep { not ($_->can('is_bytes') and $_->is_bytes) }
         @{ $self->found_files };
+    push @filenames, $self->files;
 
     $self->log_debug('adding file ' . $_) foreach @filenames;
 
@@ -147,11 +159,16 @@ L<Dist::Zilla::Role::FileFinderUser/default_finders>.
 You can define your own with the
 L<[FileFinder::ByName]|Dist::Zilla::Plugin::FileFinder::ByName> plugin.
 
+=head2 C<file>
+
+a filename to also test, in addition to any files found
+earlier. This option can be repeated to specify multiple additional files.
+
 =head2 C<filename>
 
 The filename of the test to add - defaults to F<xt/author/test-eol.t>.
 
-=for Pod::Coverage gather_files munge_files register_prereqs
+=for Pod::Coverage mvp_multivalue_args mvp_aliases gather_files munge_files register_prereqs
 
 =head1 ACKNOWLEDGMENTS
 
diff --git a/t/03-finder.t b/t/03-finder.t
index b6de62a..e47d17d 100644
--- a/t/03-finder.t
+++ b/t/03-finder.t
@@ -21,7 +21,7 @@ my $tzil = Builder->from_config(
                 [ GatherDir => ],
                 [ ExecDir => ],
                 [ 'FileFinder::ByName' => ExtraTestFiles => { dir => 'xt' } ],
-                [ 'Test::EOL' => { finder => [ ':InstallModules', ':TestFiles' ] } ],
+                [ 'Test::EOL' => { finder => [ ':InstallModules', ':TestFiles' ], file => [ 'examples/foo' ] } ],
             ),
             path(qw(source lib Foo.pm)) => <<'MODULE',
 package Foo;
@@ -46,6 +46,11 @@ use warnings;
 use Test::More tests => 1;
 pass('hi!');
 TEST
+            path(qw(source examples foo)) => <<'EXAMPLE',
+use strict;
+use warnings;
+print "hello there!\n";
+EXAMPLE
         },
     },
 );
@@ -65,6 +70,7 @@ my @files = (
     path(qw(lib Foo.pm)),
     path(qw(lib Bar.pod)),
     path(qw(t foo.t)),
+    path(qw(examples foo)),
 );
 like($content, qr/'\Q$_\E'/m, "test checks $_") foreach @files;
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libdist-zilla-plugin-test-eol-perl.git



More information about the Pkg-perl-cvs-commits mailing list