Initial commit.

This commit is contained in:
2021-02-05 22:43:13 +08:00
commit a5c281b7e3
36 changed files with 4842 additions and 0 deletions

22
t/00-signature.t Executable file
View File

@ -0,0 +1,22 @@
#!/usr/bin/perl
use strict;
print "1..1\n";
if (!-s 'SIGNATURE') {
print "ok 1 # skip No signature file found\n";
}
elsif (!eval { require Module::Signature; 1 }) {
print "ok 1 # skip ",
"Next time around, consider install Module::Signature, ",
"so you can verify the integrity of this distribution.\n";
}
elsif (!eval { require Socket; Socket::inet_aton('pgp.mit.edu') }) {
print "ok 1 # skip Cannot connect to the keyserver\n";
}
else {
(Module::Signature::verify() == Module::Signature::SIGNATURE_OK())
or print "not ";
print "ok 1 # Valid signature\n";
}
__END__

103
t/01-basic.t Executable file
View File

@ -0,0 +1,103 @@
#! /usr/bin/perl -w
# Basic test suite
#
# Copyright (c) 2003-2007 imacat.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
use 5.006;
use strict;
use Test;
BEGIN { plan tests => 21 }
use FindBin;
use File::Spec::Functions qw(catdir updir);
use File::Spec qw();
use lib $FindBin::Bin;
use vars qw($chklinks $start);
$chklinks = catdir($FindBin::Bin, updir, "blib", "script", "chklinks");
$start = catdir($FindBin::Bin, "htdocs", "dir01", "start.html");
# one level, locally, only below
eval {
@_ = `$chklinks -1 -l -q $start`;
$_ = join "", @_;
};
# 1
ok($@, "");
# 2
ok(scalar(@_), 1);
# 3
ok($_, qr/test02.html/);
# one level, locally, check parent
eval {
@_ = `$chklinks -1 -l -p -q $start`;
$_ = join "", @_;
};
# 4
ok($@, "");
# 5
ok(scalar(@_), 3);
# 6
ok($_, qr/test2.css/);
# 7
ok($_, qr/test02.html/);
# 8
ok($_, qr/test04.html/);
# recursive, locally, only below
eval {
@_ = `$chklinks -l -q $start`;
$_ = join "", @_;
};
# 9
ok($@, "");
# 10
ok(scalar(@_), 2);
# 11
ok($_, qr/test02.html/);
# 12
ok($_, qr/test3.css/);
# recursive, span remote, only below
eval {
@_ = `$chklinks -q $start`;
$_ = join "", @_;
};
# 13
ok($@, "");
# 14
ok(scalar(@_), 6);
# 15
ok($_, qr/test02\.html /);
s/^.*test02.html [^\n]*\n//m;
# 16
ok($_, qr/test3\.css /);
s/^.*test3.css [^\n]*\n//m;
# 17
ok($_, qr/^http:\/\/www\.yahoo\.com\/nonexistent /m);
s/^http:\/\/www\.yahoo\.com\/nonexistent [^\n]*\n//m;
# 18
ok($_, qr/^http:\/\/www\.domain\.invalid\/ /m);
s/^http:\/\/www\.domain\.invalid\/ [^\n]*\n//m;
# 19
ok($_, qr/^ftp:\/\/ftp\.cpan\.org\/nonexistent /m);
s/^ftp:\/\/ftp\.cpan\.org\/nonexistent [^\n]*\n//m;
# 20
ok($_, qr/^ftp:\/\/ftp\.domain\.invalid\/ /m);
s/^ftp:\/\/ftp\.domain\.invalid\/ [^\n]*\n//m;
# 21
ok($_, "");

5
t/99-pod.t Executable file
View File

@ -0,0 +1,5 @@
#!/usr/bin/perl
use Test::More;
eval "use Test::Pod 1.00";
plan skip_all => "Test::Pod 1.00 required for testing POD" if $@;
all_pod_files_ok();

24
t/htdocs/dir01/start.html Normal file
View File

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<link rel="stylesheet" type="text/css" href="../stylesheets/test.css" />
<link rel="stylesheet" type="text/css" href="../stylesheets/test2.css" />
<title>Test Start</title>
</head>
<body>
<h1>Test Start</h1>
<p xml:lang="zh-tw">這是一頁測試網頁。</p>
<ul>
<li><a href="test01.html">Test #01</a></li>
<li><a href="test02.html">Test #02</a></li>
<li><a href="../test03.html">Test #03</a></li>
<li><a href="../test04.html">Test #04</a></li>
</ul>
</body>
</html>

View File

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="US-ASCII" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<link rel="stylesheet" type="text/css" href="../stylesheets/test.css" />
<link rel="stylesheet" type="text/css" href="test3.css" />
<title>Test #01</title>
</head>
<body>
<h1>Test #01</h1>
<ul>
<li><a href="http://www.cpan.org/"><acronym title="Comprehensive Perl Archive Network">CPAN</acronym></a></li>
<li><a href="http://www.yahoo.com/nonexistent">Non-existing HTTP</a></li>
<li><a href="http://www.domain.invalid/">Non-existing HTTP host</a></li>
<li><a href="ftp://ftp.cpan.org/"><acronym title="Comprehensive Perl Archive Network">CPAN</acronym> FTP</a></li>
<li><a href="ftp://ftp.cpan.org/nonexistent">Non-existing FTP</a></li>
<li><a href="ftp://ftp.domain.invalid/">Non-existing FTP host</a></li>
</ul>
</body>
</html>

View File

@ -0,0 +1,3 @@
p {
text-indent: 0.5in;
}

14
t/htdocs/test03.html Normal file
View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="US-ASCII" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<link rel="stylesheet" type="text/css" href="../stylesheets/test.css" />
<title>Test #03</title>
</head>
<body>
<h1>Test #03</h1>
</body>
</html>