summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Green <marcgreen@cpan.org>2011-10-29 00:39:52 -0400
committerMarc Green <marcgreen@cpan.org>2011-10-31 13:26:43 -0400
commit3582575f3637e9b0014442aab54dabed7c1fa2d7 (patch)
treeed324192ec3d4455e4122860fa784371951d9ad6
parentbb5b83833d4f063f5cf1cae49015a12929002ee8 (diff)
downloadperl-smoke-me/gsoc-pod.tar.gz
Dynamically create and delete testdir/test.lib/smoke-me/gsoc-pod
Due to the '.' in 'test.lib's name, t/filenames.t fails (because '.' is the path separator on VMS). To fix this, I create and delete the directory and its contents during each test that needs to access the directory. Said tests will be skipped if the directory cannot be created (e.g., on VMS).
-rw-r--r--MANIFEST4
-rw-r--r--ext/Pod-Html/t/crossref.pod12
-rw-r--r--ext/Pod-Html/t/crossref.t37
-rw-r--r--ext/Pod-Html/t/htmldir1.pod2
-rw-r--r--ext/Pod-Html/t/htmldir1.t45
-rw-r--r--ext/Pod-Html/t/htmldir3.pod2
-rw-r--r--ext/Pod-Html/t/htmldir3.t43
-rw-r--r--ext/Pod-Html/t/htmldir5.pod2
-rw-r--r--ext/Pod-Html/t/htmldir5.t31
-rw-r--r--ext/Pod-Html/t/pod2html-lib.pl24
-rw-r--r--ext/Pod-Html/testdir/perlpodspec-copy.pod (renamed from ext/Pod-Html/test.lib/perlpodspec-copy.pod)0
-rw-r--r--ext/Pod-Html/testdir/perlvar-copy.pod (renamed from ext/Pod-Html/test.lib/perlvar-copy.pod)0
-rw-r--r--t/porting/known_pod_issues.dat8
13 files changed, 138 insertions, 72 deletions
diff --git a/MANIFEST b/MANIFEST
index b69f6c08e4..e768396219 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -3727,8 +3727,8 @@ ext/Pod-Html/bin/pod2html Translator to turn pod into HTML
ext/Pod-Html/lib/Pod/Html.pm Convert POD data to HTML
ext/Pod-Html/t/crossref.pod
ext/Pod-Html/t/crossref.t
-ext/Pod-Html/test.lib/perlpodspec-copy.pod
-ext/Pod-Html/test.lib/perlvar-copy.pod
+ext/Pod-Html/testdir/perlpodspec-copy.pod
+ext/Pod-Html/testdir/perlvar-copy.pod
ext/Pod-Html/t/feature2.pod
ext/Pod-Html/t/feature2.t
ext/Pod-Html/t/feature.pod
diff --git a/ext/Pod-Html/t/crossref.pod b/ext/Pod-Html/t/crossref.pod
index fe908d5c5f..f6dddf1f58 100644
--- a/ext/Pod-Html/t/crossref.pod
+++ b/ext/Pod-Html/t/crossref.pod
@@ -12,17 +12,17 @@ L</"item1">
L</"non existant section">
-L<perlvar-copy>
+L<var-copy>
-L<perlvar-copy/$">
+L<var-copy/$">
-C<perlvar-copy>
+C<var-copy>
-C<perlvar-copy/$">
+C<var-copy/$">
-L<perlpodspec-copy/First:>
+L<podspec-copy/First:>
-C<perlpodspec-copy/First:>
+C<podspec-copy/First:>
L<notperldoc>
diff --git a/ext/Pod-Html/t/crossref.t b/ext/Pod-Html/t/crossref.t
index 0a3ba63fa6..ec178e0024 100644
--- a/ext/Pod-Html/t/crossref.t
+++ b/ext/Pod-Html/t/crossref.t
@@ -4,20 +4,29 @@ BEGIN {
require "t/pod2html-lib.pl";
}
+END {
+ rem_test_dir();
+}
+
use strict;
use Cwd;
use File::Spec;
use File::Spec::Functions;
use Test::More tests => 1;
-my ($v, $d) = splitpath(cwd(), 1);
-my $relcwd = substr($d, length(File::Spec->rootdir()));
-
-convert_n_test("crossref", "cross references",
- "--podpath=". catdir($relcwd, 't') . ":" . catdir($relcwd, 'test.lib'),
- "--podroot=$v". File::Spec->rootdir,
- "--quiet",
-);
+SKIP: {
+ my $output = make_test_dir();
+ skip "$output", 1 if $output;
+
+ my ($v, $d) = splitpath(cwd(), 1);
+ my $relcwd = substr($d, length(File::Spec->rootdir()));
+
+ convert_n_test("crossref", "cross references",
+ "--podpath=". catdir($relcwd, 't') . ":" . catdir($relcwd, 'testdir/test.lib'),
+ "--podroot=$v". File::Spec->rootdir,
+ "--quiet",
+ );
+}
__DATA__
<?xml version="1.0" ?>
@@ -57,17 +66,17 @@ __DATA__
<p><a href="#non-existant-section">&quot;non existant section&quot;</a></p>
-<p><a href="/[RELCURRENTWORKINGDIRECTORY]/test.lib/perlvar-copy.html">perlvar-copy</a></p>
+<p><a href="/[RELCURRENTWORKINGDIRECTORY]/testdir/test.lib/var-copy.html">var-copy</a></p>
-<p><a href="/[RELCURRENTWORKINGDIRECTORY]/test.lib/perlvar-copy.html#pod-">&quot;$&quot;&quot; in perlvar-copy</a></p>
+<p><a href="/[RELCURRENTWORKINGDIRECTORY]/testdir/test.lib/var-copy.html#pod-">&quot;$&quot;&quot; in var-copy</a></p>
-<p><code>perlvar-copy</code></p>
+<p><code>var-copy</code></p>
-<p><code>perlvar-copy/$&quot;</code></p>
+<p><code>var-copy/$&quot;</code></p>
-<p><a href="/[RELCURRENTWORKINGDIRECTORY]/test.lib/perlpodspec-copy.html#First:">&quot;First:&quot; in perlpodspec-copy</a></p>
+<p><a href="/[RELCURRENTWORKINGDIRECTORY]/testdir/test.lib/podspec-copy.html#First:">&quot;First:&quot; in podspec-copy</a></p>
-<p><code>perlpodspec-copy/First:</code></p>
+<p><code>podspec-copy/First:</code></p>
<p><a>notperldoc</a></p>
diff --git a/ext/Pod-Html/t/htmldir1.pod b/ext/Pod-Html/t/htmldir1.pod
index 1c9e97b3e1..e505caaa18 100644
--- a/ext/Pod-Html/t/htmldir1.pod
+++ b/ext/Pod-Html/t/htmldir1.pod
@@ -6,7 +6,7 @@ htmldir - Test --htmldir feature
Normal text, a L<link> to nowhere,
-a link to L<perlvar-copy>,
+a link to L<var-copy>,
L<htmlescp>,
diff --git a/ext/Pod-Html/t/htmldir1.t b/ext/Pod-Html/t/htmldir1.t
index 3ce6c35dd4..a0e747ffe5 100644
--- a/ext/Pod-Html/t/htmldir1.t
+++ b/ext/Pod-Html/t/htmldir1.t
@@ -4,31 +4,44 @@ BEGIN {
require "t/pod2html-lib.pl";
}
+END {
+ rem_test_dir();
+}
+
use strict;
use Cwd;
use File::Spec;
use File::Spec::Functions;
use Test::More tests => 2;
-my ($v, $d) = splitpath(cwd(), 1);
-my $relcwd = substr($d, length(File::Spec->rootdir()));
+# XXX Separate tests that rely on test.lib from the others so they are the only
+# ones skipped (instead of all of them). This applies to htmldir{1,3,5}.t, and
+# crossref.t (as of 10/29/11).
+SKIP: {
+ my $output = make_test_dir();
+ skip "$output", 2 if $output;
+
+ my ($v, $d) = splitpath(cwd(), 1);
+ my $relcwd = substr($d, length(File::Spec->rootdir()));
-my $data_pos = tell DATA; # to read <DATA> twice
+ my $data_pos = tell DATA; # to read <DATA> twice
-convert_n_test("htmldir1", "test --htmldir and --htmlroot 1a",
- "--podpath=". catdir($relcwd, 't') . ":" . catfile($relcwd, 'test.lib'),
- "--podroot=$v". File::Spec->rootdir,
- "--htmldir=t",
-);
-seek DATA, $data_pos, 0; # to read <DATA> twice (expected output is the same)
+ convert_n_test("htmldir1", "test --htmldir and --htmlroot 1a",
+ "--podpath=". catdir($relcwd, 't') . ":" . catfile($relcwd, 'testdir/test.lib'),
+ "--podroot=$v". File::Spec->rootdir,
+ "--htmldir=t",
+ );
-convert_n_test("htmldir1", "test --htmldir and --htmlroot 1b",
- "--podpath=$relcwd",
- "--podroot=$v". File::Spec->rootdir,
- "--htmldir=". catfile $relcwd, 't',
- "--htmlroot=/",
-);
+ seek DATA, $data_pos, 0; # to read <DATA> twice (expected output is the same)
+
+ convert_n_test("htmldir1", "test --htmldir and --htmlroot 1b",
+ "--podpath=$relcwd",
+ "--podroot=$v". File::Spec->rootdir,
+ "--htmldir=". catfile $relcwd, 't',
+ "--htmlroot=/",
+ );
+}
__DATA__
<?xml version="1.0" ?>
@@ -57,7 +70,7 @@ __DATA__
<p>Normal text, a <a>link</a> to nowhere,</p>
-<p>a link to <a href="/[RELCURRENTWORKINGDIRECTORY]/test.lib/perlvar-copy.html">perlvar-copy</a>,</p>
+<p>a link to <a href="/[RELCURRENTWORKINGDIRECTORY]/testdir/test.lib/var-copy.html">var-copy</a>,</p>
<p><a href="/[RELCURRENTWORKINGDIRECTORY]/t/htmlescp.html">htmlescp</a>,</p>
diff --git a/ext/Pod-Html/t/htmldir3.pod b/ext/Pod-Html/t/htmldir3.pod
index 1c9e97b3e1..e505caaa18 100644
--- a/ext/Pod-Html/t/htmldir3.pod
+++ b/ext/Pod-Html/t/htmldir3.pod
@@ -6,7 +6,7 @@ htmldir - Test --htmldir feature
Normal text, a L<link> to nowhere,
-a link to L<perlvar-copy>,
+a link to L<var-copy>,
L<htmlescp>,
diff --git a/ext/Pod-Html/t/htmldir3.t b/ext/Pod-Html/t/htmldir3.t
index c2f3af6b88..805c9d9d41 100644
--- a/ext/Pod-Html/t/htmldir3.t
+++ b/ext/Pod-Html/t/htmldir3.t
@@ -4,32 +4,41 @@ BEGIN {
require "t/pod2html-lib.pl";
}
+END {
+ rem_test_dir();
+}
+
use strict;
use Cwd;
use File::Spec;
use File::Spec::Functions;
use Test::More tests => 2;
-my $cwd = cwd();
-my ($v, $d) = splitpath($cwd, 1);
-my $relcwd = substr($d, length(File::Spec->rootdir()));
+SKIP: {
+ my $output = make_test_dir();
+ skip "$output", 2 if $output;
-my $data_pos = tell DATA; # to read <DATA> twice
+ my $cwd = cwd();
+ my ($v, $d) = splitpath($cwd, 1);
+ my $relcwd = substr($d, length(File::Spec->rootdir()));
-convert_n_test("htmldir3", "test --htmldir and --htmlroot 3a",
- "--podpath=$relcwd",
- "--podroot=$v". File::Spec->rootdir,
- "--htmldir=". catdir($cwd, 't', ''), # test removal trailing slash,
-);
+ my $data_pos = tell DATA; # to read <DATA> twice
-seek DATA, $data_pos, 0; # to read <DATA> twice (expected output is the same)
+ convert_n_test("htmldir3", "test --htmldir and --htmlroot 3a",
+ "--podpath=$relcwd",
+ "--podroot=$v". File::Spec->rootdir,
+ "--htmldir=". catdir($cwd, 't', ''), # test removal trailing slash,
+ );
-convert_n_test("htmldir3", "test --htmldir and --htmlroot 3b",
- "--podpath=". catdir($relcwd, 't'),
- "--podroot=$v". File::Spec->rootdir,
- "--htmldir=t",
- "--outfile=t/htmldir3.html",
-);
+ seek DATA, $data_pos, 0; # to read <DATA> twice (expected output is the same)
+
+ convert_n_test("htmldir3", "test --htmldir and --htmlroot 3b",
+ "--podpath=". catdir($relcwd, 't'),
+ "--podroot=$v". File::Spec->rootdir,
+ "--htmldir=t",
+ "--outfile=t/htmldir3.html",
+ );
+}
__DATA__
<?xml version="1.0" ?>
@@ -58,7 +67,7 @@ __DATA__
<p>Normal text, a <a>link</a> to nowhere,</p>
-<p>a link to <a href="[RELCURRENTWORKINGDIRECTORY]/test.lib/perlvar-copy.html">perlvar-copy</a>,</p>
+<p>a link to <a href="[RELCURRENTWORKINGDIRECTORY]/testdir/test.lib/var-copy.html">var-copy</a>,</p>
<p><a href="[RELCURRENTWORKINGDIRECTORY]/t/htmlescp.html">htmlescp</a>,</p>
diff --git a/ext/Pod-Html/t/htmldir5.pod b/ext/Pod-Html/t/htmldir5.pod
index 1c9e97b3e1..e505caaa18 100644
--- a/ext/Pod-Html/t/htmldir5.pod
+++ b/ext/Pod-Html/t/htmldir5.pod
@@ -6,7 +6,7 @@ htmldir - Test --htmldir feature
Normal text, a L<link> to nowhere,
-a link to L<perlvar-copy>,
+a link to L<var-copy>,
L<htmlescp>,
diff --git a/ext/Pod-Html/t/htmldir5.t b/ext/Pod-Html/t/htmldir5.t
index fa6fada187..15a3901036 100644
--- a/ext/Pod-Html/t/htmldir5.t
+++ b/ext/Pod-Html/t/htmldir5.t
@@ -4,21 +4,32 @@ BEGIN {
require "t/pod2html-lib.pl";
}
+END {
+ rem_test_dir();
+}
+
use strict;
use Cwd;
use File::Spec::Functions;
use Test::More tests => 1;
-my $cwd = catdir cwd(); # catdir converts path separators to that of the OS
- # running the test
- # XXX but why don't the other tests complain about this?
+SKIP: {
+ my $output = make_test_dir();
+ skip "$output", 1 if $output;
+
-convert_n_test("htmldir5", "test --htmldir and --htmlroot 5",
- "--podpath=t:test.lib",
- "--podroot=$cwd",
- "--htmldir=$cwd",
- "--htmlroot=/",
-);
+ my $cwd = catdir cwd(); # catdir converts path separators to that of the OS
+ # running the test
+ # XXX but why don't the other tests complain about
+ # this?
+
+ convert_n_test("htmldir5", "test --htmldir and --htmlroot 5",
+ "--podpath=t:testdir/test.lib",
+ "--podroot=$cwd",
+ "--htmldir=$cwd",
+ "--htmlroot=/",
+ );
+}
__DATA__
<?xml version="1.0" ?>
@@ -47,7 +58,7 @@ __DATA__
<p>Normal text, a <a>link</a> to nowhere,</p>
-<p>a link to <a href="../test.lib/perlvar-copy.html">perlvar-copy</a>,</p>
+<p>a link to <a href="../testdir/test.lib/var-copy.html">var-copy</a>,</p>
<p><a href="./htmlescp.html">htmlescp</a>,</p>
diff --git a/ext/Pod-Html/t/pod2html-lib.pl b/ext/Pod-Html/t/pod2html-lib.pl
index f10747f0f0..7a71e4c5b7 100644
--- a/ext/Pod-Html/t/pod2html-lib.pl
+++ b/ext/Pod-Html/t/pod2html-lib.pl
@@ -2,6 +2,30 @@ require Cwd;
require Pod::Html;
require Config;
use File::Spec::Functions ':ALL';
+use File::Path 'remove_tree';
+use File::Copy;
+
+# make_test_dir and rem_test_dir dynamically create and remove testdir/test.lib.
+# it is created dynamically to pass t/filenames.t, which does not allow '.'s in
+# filenames as '.' is the directory separator on VMS. All tests that require
+# testdir/test.lib to be present are skipped if test.lib cannot be created.
+sub make_test_dir {
+ if (-d 'testdir/test.lib') {
+ warn "Directory 'test.lib' exists (it shouldn't yet) - removing it";
+ rem_test_dir();
+ }
+ mkdir('testdir/test.lib') or return "Could not make test.lib directory: $!\n";
+ copy('testdir/perlpodspec-copy.pod', 'testdir/test.lib/podspec-copy.pod')
+ or return "Could not copy perlpodspec-copy: $!";
+ copy('testdir/perlvar-copy.pod', 'testdir/test.lib/var-copy.pod')
+ or return "Could not copy perlvar-copy: $!";
+ return 0;
+}
+
+sub rem_test_dir {
+ remove_tree('testdir/test.lib')
+ or warn "Error removing temporary directory 'testdir/test.lib'";
+}
sub convert_n_test {
my($podfile, $testname, @p2h_args) = @_;
diff --git a/ext/Pod-Html/test.lib/perlpodspec-copy.pod b/ext/Pod-Html/testdir/perlpodspec-copy.pod
index 4f914ef0e4..4f914ef0e4 100644
--- a/ext/Pod-Html/test.lib/perlpodspec-copy.pod
+++ b/ext/Pod-Html/testdir/perlpodspec-copy.pod
diff --git a/ext/Pod-Html/test.lib/perlvar-copy.pod b/ext/Pod-Html/testdir/perlvar-copy.pod
index 04d2a7474c..04d2a7474c 100644
--- a/ext/Pod-Html/test.lib/perlvar-copy.pod
+++ b/ext/Pod-Html/testdir/perlvar-copy.pod
diff --git a/t/porting/known_pod_issues.dat b/t/porting/known_pod_issues.dat
index f4a53c59a3..2ba19a1c49 100644
--- a/t/porting/known_pod_issues.dat
+++ b/t/porting/known_pod_issues.dat
@@ -177,10 +177,10 @@ ext/hash-util-fieldhash/lib/hash/util/fieldhash.pm Verbatim line length includin
ext/i18n-langinfo/langinfo.pm Verbatim line length including indents exceeds 79 by 1
ext/opcode/opcode.pm Verbatim line length including indents exceeds 79 by 10
ext/pod-html/bin/pod2html Pod NAME already used 1
-ext/pod-html/test.lib/perlpodspec-copy.pod Verbatim line length including indents exceeds 79 by 8
-ext/pod-html/test.lib/perlvar-copy.pod ? Should you be using L<...> instead of 3
-ext/pod-html/test.lib/perlvar-copy.pod Apparent broken link 2
-ext/pod-html/test.lib/perlvar-copy.pod Verbatim line length including indents exceeds 79 by 6
+ext/pod-html/testdir/perlpodspec-copy.pod Verbatim line length including indents exceeds 79 by 8
+ext/pod-html/testdir/perlvar-copy.pod ? Should you be using L<...> instead of 3
+ext/pod-html/testdir/perlvar-copy.pod Apparent broken link 2
+ext/pod-html/testdir/perlvar-copy.pod Verbatim line length including indents exceeds 79 by 6
ext/posix/lib/posix.pod Verbatim line length including indents exceeds 79 by 29
ext/re/re.pm Verbatim line length including indents exceeds 79 by 6
ext/vms-dclsym/dclsym.pm ? Should you be using L<...> instead of 1