xref: /openbsd/gnu/usr.bin/perl/ext/Pod-Html/t/htmldir3.t (revision 256a93a4)
1898184e3SsthenBEGIN {
2*256a93a4Safresh1    use File::Spec::Functions ':ALL';
3*256a93a4Safresh1    @INC = map { rel2abs($_) }
4*256a93a4Safresh1             (qw| ./lib ./t/lib ../../lib |);
5898184e3Ssthen}
6898184e3Ssthen
7898184e3Ssthenuse strict;
8*256a93a4Safresh1use warnings;
9*256a93a4Safresh1use Test::More;
10*256a93a4Safresh1use Testing qw( setup_testing_dir xconvert );
11898184e3Ssthenuse Cwd;
12898184e3Ssthen
13*256a93a4Safresh1my $debug = 0;
14*256a93a4Safresh1my $startdir = cwd();
15*256a93a4Safresh1END { chdir($startdir) or die("Cannot change back to $startdir: $!"); }
16*256a93a4Safresh1my ($expect_raw, $args);
17*256a93a4Safresh1{ local $/; $expect_raw = <DATA>; }
18*256a93a4Safresh1
19*256a93a4Safresh1my $tdir = setup_testing_dir( {
20*256a93a4Safresh1    debug       => $debug,
21*256a93a4Safresh1} );
22898184e3Ssthen
23898184e3Ssthenmy $cwd = cwd();
24898184e3Ssthenmy ($v, $d) = splitpath($cwd, 1);
2591f110e0Safresh1my @dirs = splitdir($d);
2691f110e0Safresh1shift @dirs if $dirs[0] eq '';
2791f110e0Safresh1my $relcwd = join '/', @dirs;
28898184e3Ssthen
29*256a93a4Safresh1$args = {
30*256a93a4Safresh1    podstub => "htmldir3",
31*256a93a4Safresh1    description => "test --htmldir and --htmlroot 3c: as expected pod file not yet locatable either under podroot or in cache: GH 12271",
32*256a93a4Safresh1    expect => $expect_raw,
33*256a93a4Safresh1    expect_fail => 1,
34*256a93a4Safresh1    p2h => {
35*256a93a4Safresh1        podpath    => catdir($relcwd, 't'),
36*256a93a4Safresh1        podroot    => catpath($v, '/', ''),
37*256a93a4Safresh1        htmldir    => 't',
38*256a93a4Safresh1        outfile    => 't/htmldir3.html',
39*256a93a4Safresh1        quiet      => 1,
40*256a93a4Safresh1    },
41*256a93a4Safresh1    debug => $debug,
42*256a93a4Safresh1};
43*256a93a4Safresh1$args->{core} = 1 if $ENV{PERL_CORE};
44*256a93a4Safresh1xconvert($args);
45898184e3Ssthen
46*256a93a4Safresh1$args = {
47*256a93a4Safresh1    podstub => "htmldir3",
48*256a93a4Safresh1    description => "test --htmldir and --htmlroot 3a",
49*256a93a4Safresh1    expect => $expect_raw,
50*256a93a4Safresh1    p2h => {
51*256a93a4Safresh1        podpath    => $relcwd,
52*256a93a4Safresh1        podroot    => catpath($v, '/', ''),
53*256a93a4Safresh1        htmldir    => catdir($cwd, 't', ''), # test removal trailing slash,
54*256a93a4Safresh1        quiet      => 1,
55*256a93a4Safresh1    },
56*256a93a4Safresh1    debug => $debug,
57*256a93a4Safresh1};
58*256a93a4Safresh1xconvert($args);
59898184e3Ssthen
60*256a93a4Safresh1$args = {
61*256a93a4Safresh1    podstub => "htmldir3",
62*256a93a4Safresh1    description => "test --htmldir and --htmlroot 3b: as expected pod file not yet locatable either under podroot or in cache: GH 12271",
63*256a93a4Safresh1    expect => $expect_raw,
64*256a93a4Safresh1    expect_fail => 1,
65*256a93a4Safresh1    p2h => {
66*256a93a4Safresh1        podpath    => catdir($relcwd, 't'),
67*256a93a4Safresh1        podroot    => catpath($v, '/', ''),
68*256a93a4Safresh1        htmldir    => 't',
69*256a93a4Safresh1        outfile    => 't/htmldir3.html',
70*256a93a4Safresh1        quiet      => 1,
71*256a93a4Safresh1    },
72*256a93a4Safresh1    debug => $debug,
73*256a93a4Safresh1};
74*256a93a4Safresh1xconvert($args);
75898184e3Ssthen
76*256a93a4Safresh1done_testing;
77898184e3Ssthen
78898184e3Ssthen__DATA__
79898184e3Ssthen<?xml version="1.0" ?>
80898184e3Ssthen<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
81898184e3Ssthen<html xmlns="http://www.w3.org/1999/xhtml">
82898184e3Ssthen<head>
835759b3d2Safresh1<title>htmldir - Test --htmldir feature</title>
84898184e3Ssthen<meta http-equiv="content-type" content="text/html; charset=utf-8" />
85898184e3Ssthen<link rev="made" href="mailto:[PERLADMIN]" />
86898184e3Ssthen</head>
87898184e3Ssthen
886fb12b70Safresh1<body>
89898184e3Ssthen
90898184e3Ssthen
91898184e3Ssthen
92898184e3Ssthen<ul id="index">
93898184e3Ssthen  <li><a href="#NAME">NAME</a></li>
94898184e3Ssthen  <li><a href="#LINKS">LINKS</a></li>
95898184e3Ssthen</ul>
96898184e3Ssthen
97898184e3Ssthen<h1 id="NAME">NAME</h1>
98898184e3Ssthen
99898184e3Ssthen<p>htmldir - Test --htmldir feature</p>
100898184e3Ssthen
101898184e3Ssthen<h1 id="LINKS">LINKS</h1>
102898184e3Ssthen
103898184e3Ssthen<p>Normal text, a <a>link</a> to nowhere,</p>
104898184e3Ssthen
105*256a93a4Safresh1<p>a link to <a href="[RELCURRENTWORKINGDIRECTORY]/corpus/test.lib/var-copy.html">var-copy</a>,</p>
106898184e3Ssthen
107898184e3Ssthen<p><a href="[RELCURRENTWORKINGDIRECTORY]/t/htmlescp.html">htmlescp</a>,</p>
108898184e3Ssthen
109898184e3Ssthen<p><a href="[RELCURRENTWORKINGDIRECTORY]/t/feature.html#Another-Head-1">&quot;Another Head 1&quot; in feature</a>,</p>
110898184e3Ssthen
111898184e3Ssthen<p>and another <a href="[RELCURRENTWORKINGDIRECTORY]/t/feature.html#Another-Head-1">&quot;Another Head 1&quot; in feature</a>.</p>
112898184e3Ssthen
113898184e3Ssthen
114898184e3Ssthen</body>
115898184e3Ssthen
116898184e3Ssthen</html>
117898184e3Ssthen
118898184e3Ssthen
119