[libdist-zilla-plugin-test-eol-perl] 04/18: add more tests for both plugins

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


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

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

commit ea9b2cf32da12892a49e48154cac4cdb8a93fb74
Author: Karen Etheridge <ether at cpan.org>
Date:   Sun Oct 12 16:23:13 2014 -0700

    add more tests for both plugins
---
 t/01-basic.t    | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 t/02-eoltests.t | 13 ++++++++++++
 2 files changed, 74 insertions(+)

diff --git a/t/01-basic.t b/t/01-basic.t
new file mode 100644
index 0000000..e13ec3d
--- /dev/null
+++ b/t/01-basic.t
@@ -0,0 +1,61 @@
+use strict;
+use warnings FATAL => 'all';
+
+use Test::More;
+use if $ENV{AUTHOR_TESTING}, 'Test::Warnings';
+use Test::DZil;
+use Path::Tiny;
+use File::pushd 'pushd';
+use Test::Deep;
+
+my $tzil = Builder->from_config(
+    { dist_root => 't/does-not-exist' },
+    {
+        add_files => {
+            path(qw(source dist.ini)) => simple_ini(
+                [ GatherDir => ],
+                [ ExecDir => ],
+                [ 'Test::EOL' ],
+            ),
+            path(qw(source lib Foo.pm)) => <<'MODULE',
+package Foo;
+use strict;
+use warnings;
+1;
+MODULE
+        },
+    },
+);
+
+$tzil->chrome->logger->set_debug(1);
+$tzil->build;
+
+my $build_dir = path($tzil->tempdir)->child('build');
+my $file = $build_dir->child(qw(xt author test-eol.t));
+ok( -e $file, $file . ' created');
+
+my $content = $file->slurp_utf8;
+unlike($content, qr/[^\S\n]\n/m, 'no trailing whitespace in generated test');
+unlike($content, qr/\t/m, 'no tabs in generated test');
+
+# TODO: check distmeta
+
+my $files_tested;
+
+subtest 'run the generated test' => sub
+{
+    my $wd = pushd $build_dir;
+
+    do $file;
+    note 'ran tests successfully' if not $@;
+    fail($@) if $@;
+
+    $files_tested = Test::Builder->new->current_test;
+};
+
+is($files_tested, 2, 'correct number of files were tested');
+
+diag 'got log messages: ', explain $tzil->log_messages
+    if not Test::Builder->new->is_passing;
+
+done_testing;
diff --git a/t/02-eoltests.t b/t/02-eoltests.t
new file mode 100644
index 0000000..28a836e
--- /dev/null
+++ b/t/02-eoltests.t
@@ -0,0 +1,13 @@
+use strict;
+use warnings FATAL => 'all';
+
+# this is just like t/01-basic.t except we use [EOLTests].
+
+use Path::Tiny;
+my $code = path('t', '01-basic.t')->slurp_utf8;
+
+$code =~ s/Test::EOL(?!'\s*=>)/EOLTests/g;
+$code =~ s{xt(.)author(.)test-eol\.t}{xt$1release$2eol.t}g;
+
+eval $code;
+die $@ if $@;

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