This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
new perldelta
[perl5.git] / ext / Pod-Html / t / htmldir2.t
1 BEGIN {
2     use File::Spec::Functions ':ALL';
3     @INC = map { rel2abs($_) }
4              (qw| ./lib ./t/lib ../../lib |);
5 }
6
7 use strict;
8 use warnings;
9 use Test::More;
10 use Testing qw( setup_testing_dir xconvert );
11 use Cwd;
12
13 my $debug = 0;
14 my $startdir = cwd();
15 END { chdir($startdir) or die("Cannot change back to $startdir: $!"); }
16 my ($expect_raw, $args);
17 { local $/; $expect_raw = <DATA>; }
18
19 my $tdir = setup_testing_dir( {
20     debug       => $debug,
21 } );
22
23 $args = {
24     podstub => "htmldir2",
25     description => "test --htmldir and --htmlroot 2a",
26     expect => $expect_raw,
27     p2h => {
28         podpath => 't',
29         htmldir => 't',
30         quiet   => 1,
31     },
32     debug => $debug,
33 };
34 xconvert($args);
35
36 $args = {
37     podstub => "htmldir2",
38     description => "test --htmldir and --htmlroot 2b",
39     expect => $expect_raw,
40     p2h => {
41         podpath => 't',
42         quiet   => 1,
43     },
44     debug => $debug,
45 };
46 xconvert($args);
47
48 my $cwd = cwd();
49 $args = {
50     podstub => "htmldir2",
51     description => "test --htmldir and --htmlroot 2c",
52     expect => $expect_raw,
53     p2h => {
54         podpath     => 't',
55         podroot     => $cwd,
56         norecurse   => 1, # testing --norecurse, too
57         quiet       => 1,
58     },
59     debug   => $debug,
60 };
61 xconvert($args);
62
63 done_testing;
64
65 __DATA__
66 <?xml version="1.0" ?>
67 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
68 <html xmlns="http://www.w3.org/1999/xhtml">
69 <head>
70 <title>htmldir - Test --htmldir feature</title>
71 <meta http-equiv="content-type" content="text/html; charset=utf-8" />
72 <link rev="made" href="mailto:[PERLADMIN]" />
73 </head>
74
75 <body>
76
77
78
79 <ul id="index">
80   <li><a href="#NAME">NAME</a></li>
81   <li><a href="#LINKS">LINKS</a></li>
82 </ul>
83
84 <h1 id="NAME">NAME</h1>
85
86 <p>htmldir - Test --htmldir feature</p>
87
88 <h1 id="LINKS">LINKS</h1>
89
90 <p>Normal text, a <a>link</a> to nowhere,</p>
91
92 <p>a link to <a>perlvar-copy</a>,</p>
93
94 <p><a href="/t/htmlescp.html">htmlescp</a>,</p>
95
96 <p><a href="/t/feature.html#Another-Head-1">&quot;Another Head 1&quot; in feature</a>,</p>
97
98 <p>and another <a href="/t/feature.html#Another-Head-1">&quot;Another Head 1&quot; in feature</a>.</p>
99
100
101 </body>
102
103 </html>
104
105