test(11.1-07): planted fixtures and unit tests for fence, execution and name-form holes
- eighteen violation plants pin nested src=, Go aliases, unrun examples, build membership and command forms - unit tests cover fence collection, captions, goLang, go doc -c, commandWord and Sync
This commit is contained in:
@@ -71,6 +71,36 @@ func renderHTML(t *testing.T, s *site, p *Page) renderedPage {
|
||||
return r
|
||||
}
|
||||
|
||||
func TestFenceCaptionsOnlyVerified(t *testing.T) {
|
||||
guide := page("Start", "setup", 10, strings.Join([]string{
|
||||
"```go src=pkg/lib.go#Greeting",
|
||||
"func Greeting() {}",
|
||||
"```",
|
||||
"",
|
||||
"> [!TIP]",
|
||||
"> ```go src=pkg/lib.go#Greeting",
|
||||
"> func stale() {}",
|
||||
"> ```",
|
||||
"",
|
||||
}, "\n"))
|
||||
readme := "# alpha\n\nAlpha does one thing.\n\n```go src=modules/alpha/alpha.go\npackage alpha\n```\n"
|
||||
s, pages := renderFixture(t, map[string]string{
|
||||
"docs/setup/start.md": guide,
|
||||
"modules/alpha/README.md": readme,
|
||||
})
|
||||
guideHTML := string(renderHTML(t, s, pages["setup/start"]).html)
|
||||
if got := strings.Count(guideHTML, "<figcaption>"); got != 1 {
|
||||
t.Fatalf("guide figcaptions = %d, want 1\n%s", got, guideHTML)
|
||||
}
|
||||
if !strings.Contains(guideHTML, "<figcaption>pkg/lib.go#Greeting</figcaption>") {
|
||||
t.Fatalf("guide caption missing the top-level reference\n%s", guideHTML)
|
||||
}
|
||||
readmeHTML := string(renderHTML(t, s, pages["api/alpha"]).html)
|
||||
if strings.Contains(readmeHTML, "<figcaption>") {
|
||||
t.Fatalf("module README has a caption\n%s", readmeHTML)
|
||||
}
|
||||
}
|
||||
|
||||
func TestLinkRewriting(t *testing.T) {
|
||||
body := strings.Join([]string{
|
||||
"- [start](setup/start.md)",
|
||||
|
||||
Reference in New Issue
Block a user