Extract subroutines used to test File-Find into separate package.
authorJames E Keenan <jkeenan@cpan.org>
Sun, 1 Dec 2013 17:35:54 +0000 (18:35 +0100)
committerJames E Keenan <jkeenan@cpan.org>
Sun, 1 Dec 2013 17:46:07 +0000 (18:46 +0100)
t/porting/manifest.t and pod_rules.t:  Add comments describing how to handle a
MANIFEST which is not sorted properly (per recommendation by Nicholas Clark).

MANIFEST
ext/File-Find/t/find.t
ext/File-Find/t/lib/Testing.pm [new file with mode: 0644]
ext/File-Find/t/taint.t
t/porting/manifest.t
t/porting/pod_rules.t

index 17bda1e..dcd15dc 100644 (file)
--- a/MANIFEST
+++ b/MANIFEST
@@ -3573,6 +3573,7 @@ ext/File-DosGlob/lib/File/DosGlob.pm      Win32 DOS-globbing module
 ext/File-DosGlob/t/DosGlob.t           See if File::DosGlob works
 ext/File-Find/lib/File/Find.pm Routines to do a find
 ext/File-Find/t/find.t         See if File::Find works
+ext/File-Find/t/lib/Testing.pm         Functions used in testing File-find
 ext/File-Find/t/taint.t                See if File::Find works with taint
 ext/File-Glob/bsd_glob.c       File::Glob extension run time code
 ext/File-Glob/bsd_glob.h       File::Glob extension header file
index c3ee691..42b379c 100644 (file)
@@ -31,6 +31,12 @@ $test_count += 2 if $^O eq 'MSWin32' and $symlink_exists;
 
 use Test::More;
 plan tests => $test_count;
+use lib qw( ./t/lib );
+use Testing qw(
+    create_file_ok
+    mkdir_ok
+    symlink_ok
+);
 
 my %Expect_File = (); # what we expect for $_
 my %Expect_Name = (); # what we expect for $File::Find::name/fullname
@@ -130,30 +136,6 @@ END {
     cleanup();
 }
 
-# Wrappers around Test::More::ok() for creation of files, directories and
-# symlinks used in testing
-
-sub create_file_ok($;$) {
-    my $file = $_[0];
-    my $msg = $_[2] || "able to create file: $file";
-    ok( open(my $T,'>',$file), $msg )
-        or die("Unable to create file: $file");
-}
-
-sub mkdir_ok($$;$) {
-    my ($dir, $mask) = @_[0..1];
-    my $msg = $_[2] || "able to mkdir: $dir";
-    ok( mkdir($dir, $mask), $msg )
-        or die("Unable to mkdir: $dir");
-}
-
-sub symlink_ok($$;$) {
-    my ($oldfile, $newfile) = @_[0..1];
-    my $msg = $_[2] || "able to symlink from $oldfile to $newfile";
-    ok( symlink( $oldfile, $newfile ), $msg)
-      or die("Unable to symlink from $oldfile to $newfile");
-}
-
 sub wanted_File_Dir {
     print "# \$File::Find::dir => '$File::Find::dir'\t\$_ => '$_'\n";
     s#\.$## if ($^O eq 'VMS' && $_ ne '.'); #
diff --git a/ext/File-Find/t/lib/Testing.pm b/ext/File-Find/t/lib/Testing.pm
new file mode 100644 (file)
index 0000000..70c5dcd
--- /dev/null
@@ -0,0 +1,39 @@
+package Testing;
+use 5.006_001;
+use strict;
+use warnings;
+require Exporter;
+our @ISA = qw(Exporter);
+our @EXPORT_OK = qw(
+    create_file_ok
+    mkdir_ok
+    symlink_ok
+);
+
+# Wrappers around Test::More::ok() for creation of files, directories and
+# symlinks used in testing of File-Find
+
+*ok = \&Test::More::ok;
+
+sub create_file_ok($;$) {
+    my $file = $_[0];
+    my $msg = $_[2] || "able to create file: $file";
+    ok( open(my $T,'>',$file), $msg )
+        or die("Unable to create file: $file");
+}
+
+sub mkdir_ok($$;$) {
+    my ($dir, $mask) = @_[0..1];
+    my $msg = $_[2] || "able to mkdir: $dir";
+    ok( mkdir($dir, $mask), $msg )
+        or die("Unable to mkdir: $dir");
+}
+
+sub symlink_ok($$;$) {
+    my ($oldfile, $newfile) = @_[0..1];
+    my $msg = $_[2] || "able to symlink from $oldfile to $newfile";
+    ok( symlink( $oldfile, $newfile ), $msg)
+      or die("Unable to symlink from $oldfile to $newfile");
+}
+
+1;
index 100b561..e4fb6c9 100644 (file)
@@ -8,6 +8,12 @@ BEGIN {
         : (skip_all => "A perl without taint support") 
     );
 }
+use lib qw( ./t/lib );
+use Testing qw(
+    create_file_ok
+    mkdir_ok
+    symlink_ok
+);
 
 my %Expect_File = (); # what we expect for $_
 my %Expect_Name = (); # what we expect for $File::Find::name/fullname
@@ -108,20 +114,6 @@ END {
     cleanup();
 }
 
-sub create_file_ok($;$) {
-    my $file = $_[0];
-    my $msg = $_[2] || "able to create file: $file";
-    ok( open(my $T,'>',$file), $msg )
-        or die("Unable to create file: $file");
-}
-
-sub mkdir_ok($$;$) {
-    my ($dir, $mask) = @_[0..1];
-    my $msg = $_[2] || "able to mkdir: $dir";
-    ok( mkdir($dir, $mask), $msg )
-        or die("Unable to mkdir: $dir");
-}
-
 sub wanted_File_Dir {
     print "# \$File::Find::dir => '$File::Find::dir'\t\$_ => '$_'\n";
     s#\.$## if ($^O eq 'VMS' && $_ ne '.'); #
index ea4fe83..b8c63c5 100644 (file)
@@ -1,6 +1,28 @@
 #!./perl -w
 
-# Test the well-formed-ness of the MANIFEST file.
+# What does this test?
+# This tests the well-formed-ness of the MANIFEST file.
+#
+# Why do we test this?
+# TK
+#
+# It's broken - how do I fix it?
+# If MANIFEST is not sorted properly, you will get this error output:
+#      got ''MANIFEST' is NOT sorted properly
+#      # '
+#      # expected /(?^:is sorted properly)/
+#
+# To correct this, run either:
+#
+#   ./perl -Ilib Porting/manisort -o MANIFEST MANIFEST
+#
+# which will output "'MANIFEST' is NOT sorted properly" but which will
+# correct the problem; or:
+#
+#   make manifest
+#
+# which will output "WARNING: re-sorting MANIFEST" but which will also
+# correct the problem.
 
 BEGIN {
     @INC = '..' if -f '../TestInit.pm';
index cdf2ae6..5c69483 100644 (file)
@@ -1,5 +1,24 @@
 #!./perl
 
+# What does this test?
+# This test executes Porting/pod_rules.pl and reports the result of that
+# program.
+#
+# Why do we test this?
+# Among other reasons, to check the well-formed-ness of these files:
+#   win32/makefile.mk
+#   MANIFEST
+#   win32/Makefile
+#   win32/pod.mak
+#   Makefile.SH
+#   vms/descrip_mms.template
+#
+# It's broken - how do I fix it?
+# If MANIFEST fails the 'up to date' test, it will probably also fail
+# t/porting/manifest.t as well.  Follow instructions in that file for
+# correcting the MANIFEST.  When that file passes, the MANIFEST check in this
+# file will probably pass as well.
+
 BEGIN {
     chdir '..' unless -d 't';
     unshift @INC, 'lib';