feat(docsite): require src= on Go code blocks of module READMEs (quick-261118-qsd)
This commit is contained in:
@@ -16,7 +16,7 @@ import (
|
||||
)
|
||||
|
||||
// themeTree is a two-section fixture: the index (two H2 headings, a
|
||||
// callout), two setup pages and one API page with a Go fence.
|
||||
// callout), two setup pages and one API page with a src= Go fence.
|
||||
func themeTree(t *testing.T) string {
|
||||
t.Helper()
|
||||
return writeTree(t, map[string]string{
|
||||
@@ -27,8 +27,11 @@ func themeTree(t *testing.T) string {
|
||||
"docs/setup/start.md": page("Start", "setup", 10, "## Only heading\n\nText.\n"),
|
||||
"docs/setup/second.md": page("Second", "setup", 20, "Text.\n"),
|
||||
"modules/alpha/alpha.go": "package alpha\n",
|
||||
"modules/alpha/alpha_test.go": "package alpha\n\nimport \"testing\"\n\n" +
|
||||
"func TestName(t *testing.T) {\n\tif name() != \"x\" {\n\t\tt.Fatal(name())\n\t}\n}\n\n" +
|
||||
"func name() string {\n\treturn \"x\" // done\n}\n",
|
||||
"modules/alpha/README.md": "# alpha\n\nAlpha does one thing well.\n\n## Usage\n\n" +
|
||||
"```go\nfunc main() {\n\treturn \"x\" // done\n}\n```\n\n```yaml\nkey: true\n```\n",
|
||||
"```go src=modules/alpha/alpha_test.go#name\nfunc name() string {\n\treturn \"x\" // done\n}\n```\n\n```yaml\nkey: true\n```\n",
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user