Skip to content

Commit e4ee4ce

Browse files
committed
Adds tests for not-<L>inked links closes #1856
1 parent 306b4e5 commit e4ee4ce

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

xt/links-not-links.t

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/usr/bin/env perl6
2+
3+
use v6;
4+
use Test;
5+
use lib 'lib';
6+
use Test-Files;
7+
use Pod::To::HTML;
8+
use MONKEY-SEE-NO-EVAL;
9+
10+
# Every .pod6 file in the Type directory.
11+
my @files = Test-Files.files.grep({$_.ends-with: '.pod6'}).grep(* ~~ /Type | Language/);
12+
13+
plan +@files;
14+
15+
for @files -> $file {
16+
my @lines;
17+
my Int $line-no = 1;
18+
my @links = $file.IO.lines.grep( * ~~ / https? /);
19+
my @links-not-links;
20+
for @links -> $link {
21+
my $pod=qq:to/END/;
22+
=pod
23+
$link
24+
=pod
25+
END
26+
my @number-of-links = ( $link ~~ m:g{ https? } );
27+
my $html = pod2html(EVAL($pod~ "\n\$=pod"));
28+
my @number-of-hrefs = ( $html ~~ m:g{a\s+href\= } );
29+
push @links-not-links, $link if +@number-of-links > +@number-of-hrefs;
30+
}
31+
if @links-not-links {
32+
flunk "$file uses non-linked links « {@links-not-links} »";
33+
} else {
34+
pass "$file return types are ok";
35+
}
36+
}

0 commit comments

Comments
 (0)