diff options
author | Marc Green <marcgreen@cpan.org> | 2011-06-19 16:24:40 -0400 |
---|---|---|
committer | Marc Green <marcgreen@cpan.org> | 2011-10-31 13:26:40 -0400 |
commit | fbf24e084f7e43d3caa066f3520b4c32ebbb2e3a (patch) | |
tree | 5f127bed8959c61307051a244956849cee8f58f2 /ext/Pod-Html | |
parent | 1be43d30851563082d5dc74b187ae83927bf4bea (diff) | |
download | perl-fbf24e084f7e43d3caa066f3520b4c32ebbb2e3a.tar.gz |
Start modifying test cases to suit new Pod::Html
Diffstat (limited to 'ext/Pod-Html')
-rw-r--r-- | ext/Pod-Html/t/htmlcrossref.pod | 41 | ||||
-rw-r--r-- | ext/Pod-Html/t/htmlcrossref.t | 80 | ||||
-rw-r--r-- | ext/Pod-Html/t/htmldir.pod | 15 | ||||
-rw-r--r-- | ext/Pod-Html/t/htmldir.t | 80 | ||||
-rw-r--r-- | ext/Pod-Html/t/htmldir2.pod | 15 | ||||
-rw-r--r-- | ext/Pod-Html/t/htmldir2.t | 67 | ||||
-rw-r--r-- | ext/Pod-Html/t/htmldir3.pod | 15 | ||||
-rw-r--r-- | ext/Pod-Html/t/htmldir3.t | 78 | ||||
-rw-r--r-- | ext/Pod-Html/t/htmldir4.pod | 15 | ||||
-rw-r--r-- | ext/Pod-Html/t/htmldir4.t | 67 | ||||
-rw-r--r-- | ext/Pod-Html/t/htmlfeature.pod | 21 | ||||
-rw-r--r-- | ext/Pod-Html/t/htmlfeature.t | 79 | ||||
-rw-r--r-- | ext/Pod-Html/t/htmlfeature2.pod | 21 | ||||
-rw-r--r-- | ext/Pod-Html/t/htmlfeature2.t | 73 | ||||
-rw-r--r-- | ext/Pod-Html/t/pod2html-lib.pl | 20 |
15 files changed, 681 insertions, 6 deletions
diff --git a/ext/Pod-Html/t/htmlcrossref.pod b/ext/Pod-Html/t/htmlcrossref.pod new file mode 100644 index 0000000000..ea19c1fea2 --- /dev/null +++ b/ext/Pod-Html/t/htmlcrossref.pod @@ -0,0 +1,41 @@ +=head1 NAME + +htmlcrossref - Test HTML cross reference links + +=head1 LINKS + +L</"section1"> + +L<htmllink/section 2> + +L</"item1"> + +L</"non existant section"> + +L<perlvar> + +L<perlvar/$"> + +C<perlvar> + +C<perlvar/$"> + +L<perlpodspec/First:> + +C<perlpodspec/First:> + +L<notperldoc> + +=head1 TARGETS + +=head2 section1 + +This is section one. + +=over 4 + +=item item1 X<item> X<one> + +This is item one. + +=back diff --git a/ext/Pod-Html/t/htmlcrossref.t b/ext/Pod-Html/t/htmlcrossref.t new file mode 100644 index 0000000000..b8607197b5 --- /dev/null +++ b/ext/Pod-Html/t/htmlcrossref.t @@ -0,0 +1,80 @@ +#!/usr/bin/perl -w # -*- perl -*- + +BEGIN { + require "t/pod2html-lib.pl"; +} + +use strict; +use Test::More tests => 1; + +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())); + +convert_n_test("htmlcrossref", "html cross references", + "--podpath=$cwd/t:usr/share/perl", + "--podroot=/", +); + +__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"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<title></title> +<meta http-equiv="content-type" content="text/html; charset=utf-8" /> +<link rev="made" href="mailto:[PERLADMIN]" /> +</head> + +<body style="background-color: white"> + + + +<ul id="index"> + <li><a href="#NAME">NAME</a></li> + <li><a href="#LINKS">LINKS</a></li> + <li><a href="#TARGETS">TARGETS</a> + <ul> + <li><a href="#section1">section1</a></li> + </ul> + </li> +</ul> + +<h1 id="NAME">NAME</h1> + +<p>htmlcrossref - Test HTML cross reference links</p> +<h1><a name="links">LINKS</a></h1> +<p><a href="#section1">section1</a></p> +<p><a href="[CURRENTWORKINGDIRECTORY]/t/htmllink.html#section_2">section 2 in the htmllink manpage</a></p> +<p><a href="#item1">item1</a></p> +<p><a href="#non_existant_section">non existant section</a></p> +<p><a href="/usr/share/perl/5.10.1/pod/perlvar.html">the perlvar manpage</a></p> +<p><a href="/usr/share/perl/5.10.1/pod/perlvar.html#_">$" in the perlvar manpage</a></p> +<p><code>perlvar</code></p> +<p><code>perlvar/$"</code></p> +<p><a href="/usr/share/perl/5.10.1/pod/perlpodspec.html#first_">First: in the perlpodspec manpage</a></p> +<p><code>perlpodspec/First:</code></p> +<p><em>notperldoc</em></p> +<p> +</p> +<hr /> +<h1><a name="targets">TARGETS</a></h1> +<p> +</p> +<h2><a name="section1">section1</a></h2> +<p>This is section one.</p> +<dl> +<dt><strong><a name="item1" class="item">item1</a></strong></dt> + +<dd> +<p>This is item one.</p> +</dd> +</dl> + +</body> + +</html> diff --git a/ext/Pod-Html/t/htmldir.pod b/ext/Pod-Html/t/htmldir.pod new file mode 100644 index 0000000000..7b9be919ce --- /dev/null +++ b/ext/Pod-Html/t/htmldir.pod @@ -0,0 +1,15 @@ +=head1 NAME + +htmldir - Test --htmldir feature + +=head1 LINKS + +Normal text, a L<link> to nowhere, + +a link to L<perlvar>, + +L<htmlescp>, + +L<htmlfeature/Another Head 1>, + +and another L<htmlfeature/"Another Head 1">. diff --git a/ext/Pod-Html/t/htmldir.t b/ext/Pod-Html/t/htmldir.t new file mode 100644 index 0000000000..6b154d793c --- /dev/null +++ b/ext/Pod-Html/t/htmldir.t @@ -0,0 +1,80 @@ +#!/usr/bin/perl -w # -*- perl -*- + +BEGIN { + require "t/pod2html-lib.pl"; +} + +use strict; +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 $data_pos = tell DATA; # to read <DATA> twice + +convert_n_test("htmldir", "test --htmldir and --htmlroot 1a", + "--podpath=$cwd/t:usr/share/perl", + "--podroot=/", +# "--podpath=t", +# "--htmlroot=/test/dir", + "--htmldir=t", +); + +seek DATA, $data_pos, 0; # to read <DATA> twice (expected output is the same) + +convert_n_test("htmldir", "test --htmldir and --htmlroot 1b", + "--podpath=$cwd:usr/share/perl", + "--podroot=/", + "--htmldir=$cwd/t", + "--htmlroot=/", +); + +__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"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<title>htmldir - Test --htmldir feature</title> +<meta http-equiv="content-type" content="text/html; charset=utf-8" /> +<link rev="made" href="mailto:[PERLADMIN]" /> +</head> + +<body style="background-color: white"> + + +<!-- INDEX BEGIN --> +<div name="index"> +<p><a name="__index__"></a></p> + +<ul> + + <li><a href="#name">NAME</a></li> + <li><a href="#links">LINKS</a></li> +</ul> + +<hr name="index" /> +</div> +<!-- INDEX END --> + +<p> +</p> +<h1><a name="name">NAME</a></h1> +<p>htmldir - Test --htmldir feature</p> +<p> +</p> +<hr /> +<h1><a name="links">LINKS</a></h1> +<p>Normal text, a <em>link</em> to nowhere,</p> +<p>a link to <a href="/usr/share/perl/5.10.1/pod/perlvar.html">the perlvar manpage</a>,</p> +<p><a href="[CURRENTWORKINGDIRECTORY]/t/htmlescp.html">the htmlescp manpage</a>,</p> +<p><a href="[CURRENTWORKINGDIRECTORY]/t/htmlfeature.html#another_head_1">Another Head 1 in the htmlfeature manpage</a>,</p> +<p>and another <a href="[CURRENTWORKINGDIRECTORY]/t/htmlfeature.html#another_head_1">Another Head 1 in the htmlfeature manpage</a>.</p> + +</body> + +</html> diff --git a/ext/Pod-Html/t/htmldir2.pod b/ext/Pod-Html/t/htmldir2.pod new file mode 100644 index 0000000000..7b9be919ce --- /dev/null +++ b/ext/Pod-Html/t/htmldir2.pod @@ -0,0 +1,15 @@ +=head1 NAME + +htmldir - Test --htmldir feature + +=head1 LINKS + +Normal text, a L<link> to nowhere, + +a link to L<perlvar>, + +L<htmlescp>, + +L<htmlfeature/Another Head 1>, + +and another L<htmlfeature/"Another Head 1">. diff --git a/ext/Pod-Html/t/htmldir2.t b/ext/Pod-Html/t/htmldir2.t new file mode 100644 index 0000000000..e5d9c5c34c --- /dev/null +++ b/ext/Pod-Html/t/htmldir2.t @@ -0,0 +1,67 @@ +#!/usr/bin/perl -w # -*- perl -*- + +BEGIN { + require "t/pod2html-lib.pl"; +} + +use strict; +use Test::More tests => 2; + +my $data_pos = tell DATA; # to read <DATA> twice + +convert_n_test("htmldir2", "test --htmldir and --htmlroot 2a", + "--podpath=t", + "--htmldir=t", +); + +seek DATA, $data_pos, 0; # to read <DATA> twice (expected output is the same) + +convert_n_test("htmldir2", "test --htmldir and --htmlroot 2b", + "--podpath=t", +# "--htmldir=t", +); + +__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"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<title>htmldir - Test --htmldir feature</title> +<meta http-equiv="content-type" content="text/html; charset=utf-8" /> +<link rev="made" href="mailto:[PERLADMIN]" /> +</head> + +<body style="background-color: white"> + + +<!-- INDEX BEGIN --> +<div name="index"> +<p><a name="__index__"></a></p> + +<ul> + + <li><a href="#name">NAME</a></li> + <li><a href="#links">LINKS</a></li> +</ul> + +<hr name="index" /> +</div> +<!-- INDEX END --> + +<p> +</p> +<h1><a name="name">NAME</a></h1> +<p>htmldir - Test --htmldir feature</p> +<p> +</p> +<hr /> +<h1><a name="links">LINKS</a></h1> +<p>Normal text, a <em>link</em> to nowhere,</p> +<p>a link to <em>perlvar</em>,</p> +<p><a href="/t/htmlescp.html">the htmlescp manpage</a>,</p> +<p><a href="/t/htmlfeature.html#another_head_1">Another Head 1 in the htmlfeature manpage</a>,</p> +<p>and another <a href="/t/htmlfeature.html#another_head_1">Another Head 1 in the htmlfeature manpage</a>.</p> + +</body> + +</html> diff --git a/ext/Pod-Html/t/htmldir3.pod b/ext/Pod-Html/t/htmldir3.pod new file mode 100644 index 0000000000..7b9be919ce --- /dev/null +++ b/ext/Pod-Html/t/htmldir3.pod @@ -0,0 +1,15 @@ +=head1 NAME + +htmldir - Test --htmldir feature + +=head1 LINKS + +Normal text, a L<link> to nowhere, + +a link to L<perlvar>, + +L<htmlescp>, + +L<htmlfeature/Another Head 1>, + +and another L<htmlfeature/"Another Head 1">. diff --git a/ext/Pod-Html/t/htmldir3.t b/ext/Pod-Html/t/htmldir3.t new file mode 100644 index 0000000000..d0ece0f8bd --- /dev/null +++ b/ext/Pod-Html/t/htmldir3.t @@ -0,0 +1,78 @@ +#!/usr/bin/perl -w # -*- perl -*- + +BEGIN { + require "t/pod2html-lib.pl"; +} + +use strict; +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 $data_pos = tell DATA; # to read <DATA> twice + +convert_n_test("htmldir3", "test --htmldir and --htmlroot 3a", + "--podpath=$cwd", + "--podroot=/", + "--htmldir=/$cwd/t/", # test removal trailing slash +); + +seek DATA, $data_pos, 0; # to read <DATA> twice (expected output is the same) + +convert_n_test("htmldir3", "test --htmldir and --htmlroot 3b", + "--podpath=$cwd/t", + "--podroot=/", + "--htmldir=t", + "--outfile=t/htmldir4.html", +); + +__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"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<title>htmldir - Test --htmldir feature</title> +<meta http-equiv="content-type" content="text/html; charset=utf-8" /> +<link rev="made" href="mailto:[PERLADMIN]" /> +</head> + +<body style="background-color: white"> + + +<!-- INDEX BEGIN --> +<div name="index"> +<p><a name="__index__"></a></p> + +<ul> + + <li><a href="#name">NAME</a></li> + <li><a href="#links">LINKS</a></li> +</ul> + +<hr name="index" /> +</div> +<!-- INDEX END --> + +<p> +</p> +<h1><a name="name">NAME</a></h1> +<p>htmldir - Test --htmldir feature</p> +<p> +</p> +<hr /> +<h1><a name="links">LINKS</a></h1> +<p>Normal text, a <em>link</em> to nowhere,</p> +<p>a link to <em>perlvar</em>,</p> +<p><a href="[RELCURRENTWORKINGDIRECTORY]/t/htmlescp.html">the htmlescp manpage</a>,</p> +<p><a href="[RELCURRENTWORKINGDIRECTORY]/t/htmlfeature.html#another_head_1">Another Head 1 in the htmlfeature manpage</a>,</p> +<p>and another <a href="[RELCURRENTWORKINGDIRECTORY]/t/htmlfeature.html#another_head_1">Another Head 1 in the htmlfeature manpage</a>.</p> + +</body> + +</html> diff --git a/ext/Pod-Html/t/htmldir4.pod b/ext/Pod-Html/t/htmldir4.pod new file mode 100644 index 0000000000..7b9be919ce --- /dev/null +++ b/ext/Pod-Html/t/htmldir4.pod @@ -0,0 +1,15 @@ +=head1 NAME + +htmldir - Test --htmldir feature + +=head1 LINKS + +Normal text, a L<link> to nowhere, + +a link to L<perlvar>, + +L<htmlescp>, + +L<htmlfeature/Another Head 1>, + +and another L<htmlfeature/"Another Head 1">. diff --git a/ext/Pod-Html/t/htmldir4.t b/ext/Pod-Html/t/htmldir4.t new file mode 100644 index 0000000000..b16999cae2 --- /dev/null +++ b/ext/Pod-Html/t/htmldir4.t @@ -0,0 +1,67 @@ +#!/usr/bin/perl -w # -*- perl -*- + +BEGIN { + require "t/pod2html-lib.pl"; +} + +use strict; +use Test::More tests => 1; + +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())); + +convert_n_test("htmldir4", "test --htmldir and --htmlroot 4", + "--podpath=t", + "--htmldir=t", + "--outfile=t/htmldir4.html", +); + +__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"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<title>htmldir - Test --htmldir feature</title> +<meta http-equiv="content-type" content="text/html; charset=utf-8" /> +<link rev="made" href="mailto:[PERLADMIN]" /> +</head> + +<body style="background-color: white"> + + +<!-- INDEX BEGIN --> +<div name="index"> +<p><a name="__index__"></a></p> + +<ul> + + <li><a href="#name">NAME</a></li> + <li><a href="#links">LINKS</a></li> +</ul> + +<hr name="index" /> +</div> +<!-- INDEX END --> + +<p> +</p> +<h1><a name="name">NAME</a></h1> +<p>htmldir - Test --htmldir feature</p> +<p> +</p> +<hr /> +<h1><a name="links">LINKS</a></h1> +<p>Normal text, a <em>link</em> to nowhere,</p> +<p>a link to <em>perlvar</em>,</p> +<p><a href="t/htmlescp.html">the htmlescp manpage</a>,</p> +<p><a href="t/htmlfeature.html#another_head_1">Another Head 1 in the htmlfeature manpage</a>,</p> +<p>and another <a href="t/htmlfeature.html#another_head_1">Another Head 1 in the htmlfeature manpage</a>.</p> + +</body> + +</html> diff --git a/ext/Pod-Html/t/htmlfeature.pod b/ext/Pod-Html/t/htmlfeature.pod new file mode 100644 index 0000000000..8ca0ca2956 --- /dev/null +++ b/ext/Pod-Html/t/htmlfeature.pod @@ -0,0 +1,21 @@ +=head1 Head 1 + +A paragraph + +=for html some html + +=begin image + +|--| +| | +|--| + +=end image + +Another paragraph + +=head1 Another Head 1 + +some text and a link L<htmlcrossref> + +=cut diff --git a/ext/Pod-Html/t/htmlfeature.t b/ext/Pod-Html/t/htmlfeature.t new file mode 100644 index 0000000000..7425477a4a --- /dev/null +++ b/ext/Pod-Html/t/htmlfeature.t @@ -0,0 +1,79 @@ +#!/usr/bin/perl -w # -*- perl -*- +require Cwd; + +BEGIN { + require "t/pod2html-lib.pl"; +} + +use strict; +use Test::More tests => 1; + +my $cwd = Cwd::cwd(); + +convert_n_test("htmlfeature", "misc pod-html features", + "--backlink", # doesn't appear b/c of --noindex + "--css=style.css", + "--header", # no styling b/c of --ccs + "--htmldir=$cwd/t", + "--noindex", + "--podpath=t", + "--podroot=$cwd", + "--title=a title", + + ); + +__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"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<title>a title</title> +<link rel="stylesheet" href="style.css" type="text/css" /> +<meta http-equiv="content-type" content="text/html; charset=utf-8" /> +<link rev="made" href="mailto:[PERLADMIN]" /> +</head> + +<body> +<table border="0" width="100%" cellspacing="0" cellpadding="3"> +<tr><td class="block" valign="middle"> +<big><strong><span class="block"> a title</span></strong></big> +</td></tr> +</table> + + +<!-- INDEX BEGIN --> +<div name="index"> +<p><a name="__index__"></a></p> +<!-- + +<ul> + + <li><a href="#head_1">Head 1</a></li> + <li><a href="#another_head_1">Another Head 1</a></li> +</ul> + +--> + + +</div> +<!-- INDEX END --> + +<p> +</p> +<h1><a name="head_1">Head 1</a></h1> +<p>A paragraph</p> +some html<p>Another paragraph</p> +<p> +</p> +<hr /> +<h1><a name="another_head_1">Another Head 1</a></h1> +<p>some text and a link <a href="t/htmlcrossref.html">the htmlcrossref manpage</a></p> +<table border="0" width="100%" cellspacing="0" cellpadding="3"> +<tr><td class="block" valign="middle"> +<big><strong><span class="block"> a title</span></strong></big> +</td></tr> +</table> + +</body> + +</html> diff --git a/ext/Pod-Html/t/htmlfeature2.pod b/ext/Pod-Html/t/htmlfeature2.pod new file mode 100644 index 0000000000..8ca0ca2956 --- /dev/null +++ b/ext/Pod-Html/t/htmlfeature2.pod @@ -0,0 +1,21 @@ +=head1 Head 1 + +A paragraph + +=for html some html + +=begin image + +|--| +| | +|--| + +=end image + +Another paragraph + +=head1 Another Head 1 + +some text and a link L<htmlcrossref> + +=cut diff --git a/ext/Pod-Html/t/htmlfeature2.t b/ext/Pod-Html/t/htmlfeature2.t new file mode 100644 index 0000000000..925423e38c --- /dev/null +++ b/ext/Pod-Html/t/htmlfeature2.t @@ -0,0 +1,73 @@ +#!/usr/bin/perl -w # -*- perl -*- +require Cwd; + +BEGIN { + require "t/pod2html-lib.pl"; +} + +use strict; +use Test::More tests => 1; + +my $cwd = Cwd::cwd(); + +convert_n_test("htmlfeature2", "misc pod-html features 2", + "--backlink", + "--header", + "--podpath=$cwd", + "--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"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<title>Head 1</title> +<meta http-equiv="content-type" content="text/html; charset=utf-8" /> +<link rev="made" href="mailto:[PERLADMIN]" /> +</head> + +<body style="background-color: white"> +<table border="0" width="100%" cellspacing="0" cellpadding="3"> +<tr><td class="block" style="background-color: #cccccc" valign="middle"> +<big><strong><span class="block"> Head 1</span></strong></big> +</td></tr> +</table> + + +<!-- INDEX BEGIN --> +<div name="index"> +<p><a name="__index__"></a></p> + +<ul> + + <li><a href="#head_1">Head 1</a></li> + <li><a href="#another_head_1">Another Head 1</a></li> +</ul> + +<hr name="index" /> +</div> +<!-- INDEX END --> + +<p> +</p> +<h1><a name="head_1">Head 1</a></h1> +<p>A paragraph</p> +some html<p>Another paragraph</p> +<p> +<a href="#__index__"><small>'back link'</small></a> +</p> +<hr /> +<h1><a name="another_head_1">Another Head 1</a></h1> +<p>some text and a link <em>htmlcrossref</em></p> +<p><a href="#__index__"><small>'back link'</small></a></p> +<table border="0" width="100%" cellspacing="0" cellpadding="3"> +<tr><td class="block" style="background-color: #cccccc" valign="middle"> +<big><strong><span class="block"> Head 1</span></strong></big> +</td></tr> +</table> + +</body> + +</html> diff --git a/ext/Pod-Html/t/pod2html-lib.pl b/ext/Pod-Html/t/pod2html-lib.pl index fbdf4aeb0a..5b49700865 100644 --- a/ext/Pod-Html/t/pod2html-lib.pl +++ b/ext/Pod-Html/t/pod2html-lib.pl @@ -2,23 +2,29 @@ require Cwd; require Pod::Html; require Config; use File::Spec::Functions; +use 5.14.0; sub convert_n_test { my($podfile, $testname, @p2h_args) = @_; my $cwd = Cwd::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 $rel_cwd = substr($cwd, length(File::Spec->rootdir())); + my $new_dir = catdir $cwd, "t"; my $infile = catfile $new_dir, "$podfile.pod"; my $outfile = catfile $new_dir, "$podfile.html"; - # If other args to p2h are needed,use @p2h_args - @p2h_args = ("--podpath=t", "--htmlroot=/") unless @p2h_args; - + # To add/modify args to p2h, use @p2h_args Pod::Html::pod2html( - @p2h_args, - "--podroot=$cwd", "--infile=$infile", - "--outfile=$outfile" + "--outfile=$outfile", + "--podpath=t", + "--htmlroot=/", + "--podroot=$cwd", + @p2h_args, ); @@ -28,6 +34,8 @@ sub convert_n_test { # expected $expect = <DATA>; $expect =~ s/\[PERLADMIN\]/$Config::Config{perladmin}/; + $expect =~ s/\[CURRENTWORKINGDIRECTORY\]/$cwd/g; + $expect =~ s/\[RELCURRENTWORKINGDIRECTORY\]/$rel_cwd/g; if (ord("A") == 193) { # EBCDIC. $expect =~ s/item_mat_3c_21_3e/item_mat_4c_5a_6e/; } |