File: 16-pod2html.t

package info (click to toggle)
libpod-tree-perl 1.31-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 1,020 kB
  • sloc: perl: 2,231; exp: 215; makefile: 2
file content (57 lines) | stat: -rw-r--r-- 1,337 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
use 5.006;
use strict;
use warnings;
use Config;
use Test::More;

my @Files  = qw(cut for link list paragraph sequence);
my $NFiles = @Files;

plan tests => 3 * $NFiles;

my $Dir = "t/pod2html.d";

for my $file (@Files) {
	my $pod  = "$Dir/$file.pod";
	my $html = "$Dir/$file.html";
	my $exp  = "$Dir/$file.exp";

	unlink $html;
	system "$Config{perlpath} blib/script/podtree2html --notoc $pod $html";
	ok !FileCmp( $html, $exp );
}

for my $file (@Files) {
	my $pod      = "$Dir/$file.pod";
	my $html     = "$Dir/$file.html_t";
	my $exp      = "$Dir/$file.exp_t";
	my $template = "$Dir/template.txt";
	my $values   = "$Dir/values.pl";

	unlink $html;
	system "$Config{perlpath} blib/script/podtree2html --notoc -variables $values $pod $html $template";
	ok !FileCmp( $html, $exp );
}

for my $file (@Files) {
	my $pod      = "$Dir/$file.pod";
	my $html     = "$Dir/$file.html_tv";
	my $exp      = "$Dir/$file.exp_tv";
	my $template = "$Dir/template.txt";
	my $values   = "$Dir/values.pl";

	unlink $html;
	system "$Config{perlpath} blib/script/podtree2html --notoc -variables $values $pod $html $template color=red";
	ok !FileCmp( $html, $exp );
}

sub FileCmp {
	my ( $x, $y ) = @_;

	local $/ = undef;

	open my $fx, '<', $x or die "Can't open $x: $!\n";
	open my $fy, '<', $y or die "Can't open $y: $!\n";

	return <$fx> ne <$fy>;
}