From 03c4f896d76b268e3540367babbd48d4827436cc Mon Sep 17 00:00:00 2001 From: Patrice Chalin Date: Fri, 17 Sep 2021 21:26:17 -0400 Subject: [PATCH] Add a test for `file:` scheme --- htmltest/check-link_test.go | 13 +++++++++++-- htmltest/fixtures/links/brokenLinkFile.html | 10 ++++++++++ 2 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 htmltest/fixtures/links/brokenLinkFile.html diff --git a/htmltest/check-link_test.go b/htmltest/check-link_test.go index 16f6e04..9da820f 100644 --- a/htmltest/check-link_test.go +++ b/htmltest/check-link_test.go @@ -319,8 +319,8 @@ func TestAnchorInternalBrokenIgnore(t *testing.T) { tExpectIssueCount(t, hT, 0) } -func TestAnchorInternalBrokenIgnoreUrl(t *testing.T) { - // ignores links in IgnoreURLs +func TestAnchorInternalIgnoreUrl(t *testing.T) { + // ignores internal links in IgnoreURLs hT := tTestFileOpts("fixtures/links/brokenLinkInternal.html", map[string]interface{}{ "IgnoreURLs": []interface{}{"no\\w+.html"}, @@ -328,6 +328,15 @@ func TestAnchorInternalBrokenIgnoreUrl(t *testing.T) { tExpectIssueCount(t, hT, 0) } +func TestAnchorFileIgnoreUrl(t *testing.T) { + // ignores file links in IgnoreURLs + hT := tTestFileOpts("fixtures/links/brokenLinkFile.html", + map[string]interface{}{ + "IgnoreURLs": []interface{}{"no\\w+.html"}, + }) + tExpectIssueCount(t, hT, 0) +} + func TestAnchorInternalRelativeLinksBase(t *testing.T) { // passes for relative links with a base hT := tTestFile("fixtures/links/relativeLinksWithBase.html") diff --git a/htmltest/fixtures/links/brokenLinkFile.html b/htmltest/fixtures/links/brokenLinkFile.html new file mode 100644 index 0000000..4fb3239 --- /dev/null +++ b/htmltest/fixtures/links/brokenLinkFile.html @@ -0,0 +1,10 @@ + + + + +

Blah blah blah. Not a real link!

+

Blah blah blah. A real link!

+ + + +