summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Green <marcgreen@cpan.org>2011-06-24 11:14:28 -0400
committerMarc Green <marcgreen@cpan.org>2011-10-31 13:26:41 -0400
commit1d7ed44a3073f21892eceff9e92a17e20ac0cdc3 (patch)
tree47435bceb38f745e9f370c5aad7df113062c548e
parent18f1a6e3a6a2fe0c14e1602b6cc055b838df9af4 (diff)
downloadperl-1d7ed44a3073f21892eceff9e92a17e20ac0cdc3.tar.gz
Implement --recurse and update test cases
-rw-r--r--ext/Pod-Html/lib/Pod/Html.pm2
-rw-r--r--ext/Pod-Html/t/htmlcrossref.t1
-rw-r--r--ext/Pod-Html/t/htmldir2.t14
-rw-r--r--ext/Pod-Html/t/htmldir4.t20
-rw-r--r--ext/Pod-Html/t/htmlfeature2.t1
5 files changed, 29 insertions, 9 deletions
diff --git a/ext/Pod-Html/lib/Pod/Html.pm b/ext/Pod-Html/lib/Pod/Html.pm
index 552466b3d9..d4976119fd 100644
--- a/ext/Pod-Html/lib/Pod/Html.pm
+++ b/ext/Pod-Html/lib/Pod/Html.pm
@@ -270,7 +270,7 @@ sub pod2html {
# - callback used to remove $Podroot from each file
# - laborious to allow '.' in dirnames (e.g., /usr/share/perl/5.14.1)
Pod::Simple::Search->new->inc(0)->verbose($Verbose)->laborious(1)
- ->callback(\&_save_page)->survey(@Podpath);
+ ->callback(\&_save_page)->recurse($Recurse)->survey(@Podpath);
# set options for the parser
my $parser = Pod::Simple::XHTML::LocalPodLinks->new();
diff --git a/ext/Pod-Html/t/htmlcrossref.t b/ext/Pod-Html/t/htmlcrossref.t
index 509eaed6ce..96654cac88 100644
--- a/ext/Pod-Html/t/htmlcrossref.t
+++ b/ext/Pod-Html/t/htmlcrossref.t
@@ -18,6 +18,7 @@ my $cwd = substr(Cwd::cwd(), length(File::Spec->rootdir()));
convert_n_test("htmlcrossref", "html cross references",
"--podpath=$cwd/t:usr/share/perl",
"--podroot=/",
+ "--quiet",
);
__DATA__
diff --git a/ext/Pod-Html/t/htmldir2.t b/ext/Pod-Html/t/htmldir2.t
index 7b26cccd3d..592bffd9f9 100644
--- a/ext/Pod-Html/t/htmldir2.t
+++ b/ext/Pod-Html/t/htmldir2.t
@@ -5,8 +5,11 @@ BEGIN {
}
use strict;
-use Test::More tests => 2;
+use Test::More tests => 3;
+use Cwd;
+
+my $cwd = Cwd::cwd();
my $data_pos = tell DATA; # to read <DATA> twice
convert_n_test("htmldir2", "test --htmldir and --htmlroot 2a",
@@ -21,6 +24,15 @@ convert_n_test("htmldir2", "test --htmldir and --htmlroot 2b",
# "--htmldir=t",
);
+seek DATA, $data_pos, 0; # to read <DATA> thrice (expected output is the same)
+
+# this test makes sure paths are absolute unless --htmldir is specified
+convert_n_test("htmldir2", "test --htmldir and --htmlroot 2c",
+ "--podpath=t",
+ "--podroot=$cwd",
+ "--norecurse",
+);
+
__DATA__
<?xml version="1.0" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
diff --git a/ext/Pod-Html/t/htmldir4.t b/ext/Pod-Html/t/htmldir4.t
index ff3be022d6..d430eae6f2 100644
--- a/ext/Pod-Html/t/htmldir4.t
+++ b/ext/Pod-Html/t/htmldir4.t
@@ -5,22 +5,28 @@ BEGIN {
}
use strict;
-use Test::More tests => 1;
+use Test::More tests => 2;
-use File::Spec;
use Cwd;
-# XXX Is there a better way to do this? I need a relative url to cwd because of
-# --podpath and --podroot
-# Remove root dir from path
-my $cwd = substr(Cwd::cwd(), length(File::Spec->rootdir()));
+my $cwd = Cwd::cwd();
+my $data_pos = tell DATA; # to read <DATA> twice
-convert_n_test("htmldir4", "test --htmldir and --htmlroot 4",
+convert_n_test("htmldir4", "test --htmldir and --htmlroot 4a",
"--podpath=t",
"--htmldir=t",
"--outfile=t/htmldir4.html",
);
+seek DATA, $data_pos, 0; # to read <DATA> twice (expected output is the same)
+
+convert_n_test("htmldir4", "test --htmldir and --htmlroot 4b",
+ "--podpath=t",
+ "--podroot=$cwd",
+ "--htmldir=$cwd/t",
+ "--norecurse",
+);
+
__DATA__
<?xml version="1.0" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
diff --git a/ext/Pod-Html/t/htmlfeature2.t b/ext/Pod-Html/t/htmlfeature2.t
index 5932392a67..9f9e90b622 100644
--- a/ext/Pod-Html/t/htmlfeature2.t
+++ b/ext/Pod-Html/t/htmlfeature2.t
@@ -16,6 +16,7 @@ convert_n_test("htmlfeature2", "misc pod-html features 2",
"--podpath=.",
"--podroot=$cwd",
"--norecurse",
+ "--verbose",
);
__DATA__