From 58640fb9e668911ee9625eae9923e1795f1b8082 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sven=20Sch=C3=B6ling?= Date: Fri, 21 Jan 2011 11:32:48 +0100 Subject: [PATCH] Experimentelles Linkchecker Testscript --- t/007broken_links.t | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 t/007broken_links.t diff --git a/t/007broken_links.t b/t/007broken_links.t new file mode 100644 index 000000000..f0162eba1 --- /dev/null +++ b/t/007broken_links.t @@ -0,0 +1,36 @@ +#!/usr/bin/perl + +use strict; +use File::Find; +use LWP::Simple; +use Test::More tests => 1; +use URI::Find; + +my @fails; + +my $finder = URI::Find->new(sub { + my ($uri_obj, $uri_text) = @_; + $uri_text =~ s/^\$//; + + push @fails, "$uri_text in file $File::Find::name" + if !defined get($uri_text); + + return $_[1]; +}); + +find(sub { + open(FH, $File::Find::name) or return; + my $text; + { local $/; $text = ; } + + $finder->find(\$text); + + }, "." +); + +if (@fails) { + ok(0, join "\n", @fails); +} else { + ok(1, "no broken links found"); +} -- 2.20.1