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) {
|
if len(page.Ancestors) < len(ancestry) {
|
||||||
return nil, fmt.Errorf(
|
actual := []string{}
|
||||||
"page %q has fewer parents than specified: %s",
|
for _, ancestor := range page.Ancestors {
|
||||||
page.Title,
|
actual = append(actual, ancestor.Title)
|
||||||
strings.Join(ancestry, ` > `),
|
}
|
||||||
)
|
|
||||||
|
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] {
|
for _, parent := range ancestry[:len(ancestry)-1] {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user