diff --git a/tests/checker/data/anchor1.html b/tests/checker/data/anchor1.html
new file mode 100644
index 00000000..bc23a11e
--- /dev/null
+++ b/tests/checker/data/anchor1.html
@@ -0,0 +1,10 @@
+
+one one
+one two
+one three
+one four
+
+
+anchor1 one from 1
+anchor2 two from 1
+anchor2 three from 1
diff --git a/tests/checker/data/anchor1.html.result b/tests/checker/data/anchor1.html.result
new file mode 100644
index 00000000..13902ab3
--- /dev/null
+++ b/tests/checker/data/anchor1.html.result
@@ -0,0 +1,76 @@
+url #twofour
+cache key file://%(curdir)s/%(datadir)s/anchor2.html#twofour
+real url file://%(curdir)s/%(datadir)s/anchor2.html#twofour
+name anchor2 four from 2
+valid
+
+url #threefour
+cache key file://%(curdir)s/%(datadir)s/anchor3.html#threefour
+real url file://%(curdir)s/%(datadir)s/anchor3.html#threefour
+name anchor3 four from 3
+valid
+
+url #oneone
+cache key file://%(curdir)s/%(datadir)s/anchor1.html#oneone
+real url file://%(curdir)s/%(datadir)s/anchor1.html#oneone
+name anchor1 one from 1
+valid
+
+url #twoone
+cache key file://%(curdir)s/%(datadir)s/anchor2.html#twoone
+real url file://%(curdir)s/%(datadir)s/anchor2.html#twoone
+name anchor2 one from 2
+valid
+
+url #threeone
+cache key file://%(curdir)s/%(datadir)s/anchor3.html#threeone
+real url file://%(curdir)s/%(datadir)s/anchor3.html#threeone
+name anchor3 one from 3
+valid
+
+url anchor1.html#onefour
+cache key file://%(curdir)s/%(datadir)s/anchor1.html#onefour
+real url file://%(curdir)s/%(datadir)s/anchor1.html#onefour
+name anchor1 four from 3
+valid
+
+url anchor1.html#onethree
+cache key file://%(curdir)s/%(datadir)s/anchor1.html#onethree
+real url file://%(curdir)s/%(datadir)s/anchor1.html#onethree
+name anchor1 three from 3
+valid
+
+url anchor1.html#onetwo
+cache key file://%(curdir)s/%(datadir)s/anchor1.html#onetwo
+real url file://%(curdir)s/%(datadir)s/anchor1.html#onetwo
+name anchor1 two from 3
+valid
+
+url anchor2.html#twothree
+cache key file://%(curdir)s/%(datadir)s/anchor2.html#twothree
+real url file://%(curdir)s/%(datadir)s/anchor2.html#twothree
+name anchor2 three from 1
+valid
+
+url anchor2.html#twotwo
+cache key file://%(curdir)s/%(datadir)s/anchor2.html#twotwo
+real url file://%(curdir)s/%(datadir)s/anchor2.html#twotwo
+name anchor2 two from 1
+valid
+
+url anchor3.html#threethree
+cache key file://%(curdir)s/%(datadir)s/anchor3.html#threethree
+real url file://%(curdir)s/%(datadir)s/anchor3.html#threethree
+name anchor3 three from 2
+valid
+
+url anchor3.html#threetwo
+cache key file://%(curdir)s/%(datadir)s/anchor3.html#threetwo
+real url file://%(curdir)s/%(datadir)s/anchor3.html#threetwo
+name anchor3 two from 2
+valid
+
+url file://%(curdir)s/%(datadir)s/anchor1.html
+cache key file://%(curdir)s/%(datadir)s/anchor1.html
+real url file://%(curdir)s/%(datadir)s/anchor1.html
+valid
diff --git a/tests/checker/data/anchor2.html b/tests/checker/data/anchor2.html
new file mode 100644
index 00000000..781bc029
--- /dev/null
+++ b/tests/checker/data/anchor2.html
@@ -0,0 +1,13 @@
+
+two one
+two two
+two three
+two four
+
+<-- links -->
+anchor2 one from 2
+anchor3 two from 2
+anchor3 three from 2
+
+anchor2 four from 2
+anchor1 one from 2
diff --git a/tests/checker/data/anchor3.html b/tests/checker/data/anchor3.html
new file mode 100644
index 00000000..a6fd1546
--- /dev/null
+++ b/tests/checker/data/anchor3.html
@@ -0,0 +1,13 @@
+
+three one
+three two
+three three
+three four
+
+<-- links -->
+anchor3 one from 3
+anchor1 two from 3
+anchor1 three from 3
+
+anchor3 four from 3
+anchor1 four from 3
diff --git a/tests/checker/test_anchor.py b/tests/checker/test_anchor.py
index 186ca05d..df981cec 100644
--- a/tests/checker/test_anchor.py
+++ b/tests/checker/test_anchor.py
@@ -49,3 +49,18 @@ class TestHttpAnchor(HttpServerTest):
def test_anchor_html(self):
confargs = dict(enabledplugins=["AnchorCheck"], recursionlevel=1)
self.file_test("http_anchor.html", confargs=confargs)
+
+
+class TestAnchorsAcrossMultipleFiles(LinkCheckTest):
+ """Test anchors when there are multiple files"""
+
+ def test_anchor1_file(self):
+ """
+ Test a network of files that reference each other, starting with anchor1.html
+ """
+ filename = "anchor1.html"
+ confargs = {"enabledplugins": ["AnchorCheck"]}
+ url = "file://%(curdir)s/%(datadir)s/%(filename)s" % self.get_attrs(
+ filename=filename)
+ resultlines = self.get_resultlines(filename)
+ self.direct(url, resultlines, recursionlevel=4, confargs=confargs)