mirror of
https://github.com/kovetskiy/mark.git
synced 2025-04-23 21:32:41 +08:00
show what ancestors were expected
This commit is contained in:
parent
4b2f1cd739
commit
58ad4ff85b
@ -109,11 +109,15 @@ func ValidateAncestry(
|
||||
}
|
||||
|
||||
if len(page.Ancestors) < len(ancestry) {
|
||||
return nil, fmt.Errorf(
|
||||
"page %q has fewer parents than specified: %s",
|
||||
page.Title,
|
||||
strings.Join(ancestry, ` > `),
|
||||
)
|
||||
actual := []string{}
|
||||
for _, ancestor := range page.Ancestors {
|
||||
actual = append(actual, ancestor.Title)
|
||||
}
|
||||
|
||||
return nil, karma.Describe("title", page.Title).
|
||||
Describe("actual", strings.Join(actual, " > ")).
|
||||
Describe("expected", strings.Join(ancestry, ">")).
|
||||
Format(nil, "the page has fewer parents than expected")
|
||||
}
|
||||
|
||||
for _, parent := range ancestry[:len(ancestry)-1] {
|
||||
|
Loading…
x
Reference in New Issue
Block a user