Reuse parsed validation content by blob
This commit is contained in:
@@ -150,6 +150,24 @@ func TestCheckMarkdownLinksUsesResolvedMarkdownIdentity(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestCheckMarkdownLinksUsesCurrentPathForSharedDocuments(t *testing.T) {
|
||||
shared := []byte("[target](target.md)\n")
|
||||
_, tree := committedMarkdownTree(t, map[string][]byte{
|
||||
"one/guide.md": shared,
|
||||
"one/target.md": []byte("# Target\n"),
|
||||
"two/guide.md": shared,
|
||||
})
|
||||
|
||||
err := checkMarkdownLinks(context.Background(), tree, false, nil)
|
||||
var failure *Failure
|
||||
if !errors.As(err, &failure) || failure.Check != MarkdownLinks || len(failure.Findings) != 1 {
|
||||
t.Fatalf("checkMarkdownLinks() error = %v, want one path-specific finding", err)
|
||||
}
|
||||
if finding := failure.Findings[0]; finding.Path != "two/guide.md" || finding.Target != "target.md" {
|
||||
t.Fatalf("shared-document finding = %#v, want missing target relative to two/guide.md", finding)
|
||||
}
|
||||
}
|
||||
|
||||
func TestCheckMarkdownLinksReportsBoundaryAndSubmoduleObservations(t *testing.T) {
|
||||
repository, tree := committedMarkdownTree(t, map[string][]byte{
|
||||
"guide.md": []byte("[outside](../../outside.md)\n[submodule](deps/module/README.md)\n"),
|
||||
|
||||
Reference in New Issue
Block a user