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(); 24 25$args = { 26 podstub => "htmldir4", 27 description => "test --htmldir and --htmlroot 4a", 28 expect => $expect_raw, 29 p2h => { 30 podpath => 't', 31 htmldir => 't', 32 outfile => catfile('t', 'htmldir4.html'), 33 quiet => 1, 34 }, 35 debug => $debug, 36}; 37xconvert($args); 38 39$args = { 40 podstub => "htmldir4", 41 description => "test --htmldir and --htmlroot 4b", 42 expect => $expect_raw, 43 p2h => { 44 podpath => 't', 45 podroot => $cwd, 46 htmldir => catdir($cwd, 't'), 47 norecurse => 1, 48 quiet => 1, 49 }, 50 debug => $debug, 51}; 52xconvert($args); 53 54done_testing; 55 56__DATA__ 57<?xml version="1.0" ?> 58<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 59<html xmlns="http://www.w3.org/1999/xhtml"> 60<head> 61<title>htmldir - Test --htmldir feature</title> 62<meta http-equiv="content-type" content="text/html; charset=utf-8" /> 63<link rev="made" href="mailto:[PERLADMIN]" /> 64</head> 65 66<body> 67 68 69 70<ul id="index"> 71 <li><a href="#NAME">NAME</a></li> 72 <li><a href="#LINKS">LINKS</a></li> 73</ul> 74 75<h1 id="NAME">NAME</h1> 76 77<p>htmldir - Test --htmldir feature</p> 78 79<h1 id="LINKS">LINKS</h1> 80 81<p>Normal text, a <a>link</a> to nowhere,</p> 82 83<p>a link to <a>perlvar-copy</a>,</p> 84 85<p><a href="t/htmlescp.html">htmlescp</a>,</p> 86 87<p><a href="t/feature.html#Another-Head-1">"Another Head 1" in feature</a>,</p> 88 89<p>and another <a href="t/feature.html#Another-Head-1">"Another Head 1" in feature</a>.</p> 90 91 92</body> 93 94</html> 95 96 97