[libdist-zilla-plugin-test-podspelling-perl] 76/86: Use Test::Tester and run the actual xt file

Axel Beckert abe at deuxchevaux.org
Mon May 25 10:02:13 UTC 2015


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

abe pushed a commit to annotated tag 2.001001
in repository libdist-zilla-plugin-test-podspelling-perl.

commit 530080f88a00df005e43cee868cc191b2062bc51
Author: Randy Stauner <randy at magnificent-tears.com>
Date:   Tue Sep 6 07:32:39 2011 -0700

    Use Test::Tester and run the actual xt file
    
    to verify that the files we want are actually getting checked.
---
 t/checked.t | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 55 insertions(+)

diff --git a/t/checked.t b/t/checked.t
new file mode 100644
index 0000000..3e95647
--- /dev/null
+++ b/t/checked.t
@@ -0,0 +1,55 @@
+use strict;
+use warnings;
+use Test::Tester;
+use Test::More 0.88;
+use Test::Spelling;
+
+use Dist::Zilla::Tester;
+use Path::Class;
+use Cwd ();
+
+# lib/ and bin/
+spell_check_dist( foo   => file(qw(bin foo)), file(qw(lib Foo.pm)) );
+# just lib/
+spell_check_dist( nobin => file(qw(lib Foo.pm)) );
+
+done_testing;
+
+sub spell_check_dist {
+  my ($dir, @files) = @_;
+  my $tzil = Dist::Zilla::Tester->from_config({
+    dist_root => dir('corpus', $dir),
+  }, {
+    tempdir_root => '.build', # avoid creating ./tmp
+  });
+  $tzil->build;
+
+  my $cwd = Cwd::cwd;
+  # tests typically run from the build dir
+  chdir $tzil->tempdir->subdir('build') or die "chdir failed: $!";
+
+  check_tests(
+    sub {
+      # all_pod_files_spelling_ok sets a plan which causes problems
+      local *Test::Tester::Delegate::plan = sub {};
+
+      # run the actual xt file
+      do "${\ file(qw(xt author pod-spell.t)) }";
+    },
+    [
+      map {
+        +{
+          ok => 1,
+          name => 'POD spelling for ' . $_,
+          # depth: starts at 1; +1 for do-file; +1 for the all_ func
+          depth => 3,
+        },
+      }
+        @files
+    ],
+    "spell check pod for $dir"
+  );
+
+  # change back
+  chdir $cwd or die "chdir failed: $!";
+}

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



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