[libdist-zilla-plugin-test-eol-perl] 01/03: Allow checking for trailing whitespace

Intrigeri intrigeri at moszumanska.debian.org
Sun Aug 16 09:19:41 UTC 2015


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

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

commit 0334228c68d6470809c39592a095bb4ce4f2485d
Author: Florian Ragwitz <rafl at debian.org>
Date:   Thu Jun 3 19:35:27 2010 +0200

    Allow checking for trailing whitespace
    
    Does so by default, but can be turned off with trailing_whitespace = 0
---
 lib/Dist/Zilla/Plugin/EOLTests.pm | 28 +++++++++++++++++++++++++++-
 1 file changed, 27 insertions(+), 1 deletion(-)

diff --git a/lib/Dist/Zilla/Plugin/EOLTests.pm b/lib/Dist/Zilla/Plugin/EOLTests.pm
index 2043c25..90235c5 100644
--- a/lib/Dist/Zilla/Plugin/EOLTests.pm
+++ b/lib/Dist/Zilla/Plugin/EOLTests.pm
@@ -5,6 +5,7 @@ use Moose;
 use namespace::autoclean;
 
 extends 'Dist::Zilla::Plugin::InlineFiles';
+with 'Dist::Zilla::Role::TextTemplate';
 
 =head1 DESCRIPTION
 
@@ -15,8 +16,33 @@ the following files:
 * xt/release/eol.t
 a standard Test::EOL test
 
+=attr trailing_whitespace
+
+If this option is set to a true value,
+C<< { trailing_whitespace => 1 } >> will be passed to
+L<Test::EOL/all_perl_files_ok>. It defaults to C<1>.
+
 =cut
 
+has trailing_whitespace => (
+    is      => 'ro',
+    isa     => 'Bool',
+    default => 1,
+);
+
+around add_file => sub {
+    my ($orig, $self, $file) = @_;
+    return $self->$orig(
+        Dist::Zilla::File::InMemory->new({
+            name    => $file->name,
+            content => $self->fill_in_string(
+                $file->content,
+                { trailing_ws => \$self->trailing_whitespace },
+            ),
+        }),
+    );
+};
+
 __PACKAGE__->meta->make_immutable;
 
 1;
@@ -30,4 +56,4 @@ use Test::More;
 eval 'use Test::EOL';
 plan skip_all => 'Test::EOL required' if $@;
 
-all_perl_files_ok();
+all_perl_files_ok({ trailing_whitespace => {{ $trailing_ws }} });

-- 
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