1BEGIN { 2 use File::Spec::Functions ':ALL'; 3 @INC = map { rel2abs($_) } 4 (qw| ./lib ./t/lib ../../lib |); 5} 6 7use strict; 8use warnings; 9use Test::More; 10use Testing qw( setup_testing_dir xconvert ); 11use Cwd; 12 13my $debug = 0; 14my $startdir = cwd(); 15END { chdir($startdir) or die("Cannot change back to $startdir: $!"); } 16my ($expect_raw, $args); 17{ local $/; $expect_raw = <DATA>; } 18 19my $tdir = setup_testing_dir( { 20 debug => $debug, 21} ); 22 23my $cwd = cwd(); 24my ($v, $d) = splitpath($cwd, 1); 25my @dirs = splitdir($d); 26shift @dirs if $dirs[0] eq ''; 27my $relcwd = join '/', @dirs; 28 29$args = { 30 podstub => "htmldir3", 31 description => "test --htmldir and --htmlroot 3c: as expected pod file not yet locatable either under podroot or in cache: GH 12271", 32 expect => $expect_raw, 33 expect_fail => 1, 34 p2h => { 35 podpath => catdir($relcwd, 't'), 36 podroot => catpath($v, '/', ''), 37 htmldir => 't', 38 outfile => 't/htmldir3.html', 39 quiet => 1, 40 }, 41 debug => $debug, 42}; 43$args->{core} = 1 if $ENV{PERL_CORE}; 44xconvert($args); 45 46$args = { 47 podstub => "htmldir3", 48 description => "test --htmldir and --htmlroot 3a", 49 expect => $expect_raw, 50 p2h => { 51 podpath => $relcwd, 52 podroot => catpath($v, '/', ''), 53 htmldir => catdir($cwd, 't', ''), # test removal trailing slash, 54 quiet => 1, 55 }, 56 debug => $debug, 57}; 58xconvert($args); 59 60$args = { 61 podstub => "htmldir3", 62 description => "test --htmldir and --htmlroot 3b: as expected pod file not yet locatable either under podroot or in cache: GH 12271", 63 expect => $expect_raw, 64 expect_fail => 1, 65 p2h => { 66 podpath => catdir($relcwd, 't'), 67 podroot => catpath($v, '/', ''), 68 htmldir => 't', 69 outfile => 't/htmldir3.html', 70 quiet => 1, 71 }, 72 debug => $debug, 73}; 74xconvert($args); 75 76done_testing; 77 78__DATA__ 79<?xml version="1.0" ?> 80<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 81<html xmlns="http://www.w3.org/1999/xhtml"> 82<head> 83<title>htmldir - Test --htmldir feature</title> 84<meta http-equiv="content-type" content="text/html; charset=utf-8" /> 85<link rev="made" href="mailto:[PERLADMIN]" /> 86</head> 87 88<body> 89 90 91 92<ul id="index"> 93 <li><a href="#NAME">NAME</a></li> 94 <li><a href="#LINKS">LINKS</a></li> 95</ul> 96 97<h1 id="NAME">NAME</h1> 98 99<p>htmldir - Test --htmldir feature</p> 100 101<h1 id="LINKS">LINKS</h1> 102 103<p>Normal text, a <a>link</a> to nowhere,</p> 104 105<p>a link to <a href="[RELCURRENTWORKINGDIRECTORY]/corpus/test.lib/var-copy.html">var-copy</a>,</p> 106 107<p><a href="[RELCURRENTWORKINGDIRECTORY]/t/htmlescp.html">htmlescp</a>,</p> 108 109<p><a href="[RELCURRENTWORKINGDIRECTORY]/t/feature.html#Another-Head-1">"Another Head 1" in feature</a>,</p> 110 111<p>and another <a href="[RELCURRENTWORKINGDIRECTORY]/t/feature.html#Another-Head-1">"Another Head 1" in feature</a>.</p> 112 113 114</body> 115 116</html> 117 118 119