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:
Jakub Zych
2026-10-01 08:45:34 +02:00
parent efc3161c3f
commit 9ba5530ca7
48 changed files with 890 additions and 0 deletions

View File

@@ -0,0 +1,19 @@
---
title: FAQ
description: "Questions about the demo."
section: extras
order: 20
---
# FAQ
## Does it migrate
Yes, run `./bin/demo migrate`, then `summer docs:sync` after a source change.
```text
summer not:checked in a text fence
```
```sh
bin/demo no:such
```

View File

@@ -0,0 +1,3 @@
rule: command
file: docs/extras/faq.md
message: "no:such" is not a summer or application command

View File

@@ -0,0 +1,19 @@
---
title: FAQ
description: "Questions about the demo."
section: extras
order: 20
---
# FAQ
## Does it migrate
Yes, run `./bin/demo migrate`, then `summer docs:sync` after a source change.
```text
summer not:checked in a text fence
```
```sh
FOO=1 summer no:such
```

View File

@@ -0,0 +1,3 @@
rule: command
file: docs/extras/faq.md
message: "no:such" is not a summer or application command

View File

@@ -0,0 +1,19 @@
---
title: FAQ
description: "Questions about the demo."
section: extras
order: 20
---
# FAQ
## Does it migrate
Yes, run `./bin/demo migrate`, then `summer docs:sync` after a source change.
```text
summer not:checked in a text fence
```
```sh
summer --root . no:such
```

View File

@@ -0,0 +1,3 @@
rule: command
file: docs/extras/faq.md
message: "no:such" is not a summer or application command

View File

@@ -0,0 +1,19 @@
---
title: FAQ
description: "Questions about the demo."
section: extras
order: 20
---
# FAQ
## Does it migrate
Yes, run `./bin/demo migrate`, then `summer docs:sync` after a source change.
```text
summer not:checked in a text fence
```
```sh
go run ./cmd/summer no:such
```

View File

@@ -0,0 +1,3 @@
rule: command
file: docs/extras/faq.md
message: "no:such" is not a summer or application command

View File

@@ -0,0 +1,20 @@
---
title: FAQ
description: "Questions about the demo."
section: extras
order: 20
---
# FAQ
## Does it migrate
Yes, run `./bin/demo migrate`, then `summer docs:sync` after a source change.
```text
summer not:checked in a text fence
```
> [!NOTE]
> ```sh
> summer no:such
> ```

View File

@@ -0,0 +1,3 @@
rule: command
file: docs/extras/faq.md
message: "no:such" is not a summer or application command

View File

@@ -0,0 +1,20 @@
---
title: FAQ
description: "Questions about the demo."
section: extras
order: 20
---
# FAQ
## Does it migrate
Yes, run `./bin/demo migrate`, then `summer docs:sync` after a source change.
```text
summer not:checked in a text fence
```
> [!NOTE]
> ```go
> x := 1
> ```

View File

@@ -0,0 +1,3 @@
rule: snippet
file: docs/extras/faq.md
message: go code block has no src= reference

View File

@@ -0,0 +1,19 @@
---
title: FAQ
description: "Questions about the demo."
section: extras
order: 20
---
# FAQ
## Does it migrate
Yes, run `./bin/demo migrate`, then `summer docs:sync` after a source change.
```text
summer not:checked in a text fence
```
```golang
x := 1
```

View File

@@ -0,0 +1,3 @@
rule: snippet
file: docs/extras/faq.md
message: golang code block has no src= reference

View File

@@ -0,0 +1,17 @@
---
title: FAQ
description: "Questions about the demo."
section: extras
order: 20
---
# FAQ
## Does it migrate
Yes, run `./bin/demo migrate`, then `summer docs:sync` after a source change.
```text
summer not:checked in a text fence
```
Call `demo.Openfromapp`.

View File

@@ -0,0 +1,4 @@
package demo
// OpenFromApp is a fixture.
func OpenFromApp() {}

View File

@@ -0,0 +1,3 @@
rule: identifier
file: docs/extras/faq.md
message: demo.Openfromapp does not exist in modules/demo

View File

@@ -0,0 +1,24 @@
---
title: FAQ
description: "Questions about the demo."
section: extras
order: 20
---
# FAQ
## Does it migrate
Yes, run `./bin/demo migrate`, then `summer docs:sync` after a source change.
```text
summer not:checked in a text fence
```
> ```yaml src=config/app.yaml
> app:
> # docs:start db
> db:
> host: localhost
> port: 5432
> # docs:end db
> ```

View File

@@ -0,0 +1,3 @@
rule: snippet
file: docs/extras/faq.md
message: config/app.yaml: src= code block must be a top-level block

View File

@@ -0,0 +1,19 @@
---
title: FAQ
description: "Questions about the demo."
section: extras
order: 20
---
# FAQ
## Does it migrate
Yes, run `./bin/demo migrate`, then `summer docs:sync` after a source change.
```text
summer not:checked in a text fence
```
```go src=modules/demo/demo_test.go#ignoredOnly
func ignoredOnly() string { return "x" }
```

View File

@@ -0,0 +1,15 @@
package demo
import "testing"
func TestGreet(t *testing.T) {
// docs:start greet
g := Greeter{Name: "blog"}
got := g.Greet()
// docs:end greet
if got != "Hello, blog" {
t.Fatalf("Greet() = %q", got)
}
}
func ignoredOnly() string { return "x" }

View File

@@ -0,0 +1,7 @@
//go:build ignore
package demo
import "testing"
func TestIgnored(t *testing.T) { _ = ignoredOnly() }

View File

@@ -0,0 +1,3 @@
rule: snippet
file: docs/extras/faq.md
message: fragment is not inside a Test or Example function

View File

@@ -0,0 +1,20 @@
---
title: FAQ
description: "Questions about the demo."
section: extras
order: 20
---
# FAQ
## Does it migrate
Yes, run `./bin/demo migrate`, then `summer docs:sync` after a source change.
```text
summer not:checked in a text fence
```
```go src=modules/demo/broken.go#Broken
// Broken is never built.
func Broken() { undefinedCall() }
```

View File

@@ -0,0 +1,6 @@
//go:build ignore
package demo
// Broken is never built.
func Broken() { undefinedCall() }

View File

@@ -0,0 +1,3 @@
rule: snippet
file: docs/extras/faq.md
message: modules/demo/broken.go#Broken: file is excluded from the default build

View File

@@ -0,0 +1,20 @@
---
title: FAQ
description: "Questions about the demo."
section: extras
order: 20
---
# FAQ
## Does it migrate
Yes, run `./bin/demo migrate`, then `summer docs:sync` after a source change.
```text
summer not:checked in a text fence
```
> [!TIP]
> ```go src=modules/demo/example_test.go#ExampleHello
> BOGUS
> ```

View File

@@ -0,0 +1,3 @@
rule: snippet
file: docs/extras/faq.md
message: modules/demo/example_test.go#ExampleHello: src= code block must be a top-level block

View File

@@ -0,0 +1,20 @@
---
title: FAQ
description: "Questions about the demo."
section: extras
order: 20
---
# FAQ
## Does it migrate
Yes, run `./bin/demo migrate`, then `summer docs:sync` after a source change.
```text
summer not:checked in a text fence
```
> [!NOTE]
> ```go src=modules/demo/missing_test.go#ExampleNope
> fmt.Println()
> ```

View File

@@ -0,0 +1,3 @@
rule: snippet
file: docs/extras/faq.md
message: modules/demo/missing_test.go#ExampleNope: src= code block must be a top-level block

View File

@@ -0,0 +1,19 @@
---
title: FAQ
description: "Questions about the demo."
section: extras
order: 20
---
# FAQ
## Does it migrate
Yes, run `./bin/demo migrate`, then `summer docs:sync` after a source change.
```text
summer not:checked in a text fence
```
```go src=modules/demo/never_test.go#neverRunHelper
func neverRunHelper() {}
```

View File

@@ -0,0 +1,7 @@
package demo_test
func Example_neverRun() {
neverRunHelper()
}
func neverRunHelper() {}

View File

@@ -0,0 +1,3 @@
rule: snippet
file: docs/extras/faq.md
message: fragment is not inside a Test or Example function

View File

@@ -0,0 +1,19 @@
---
title: FAQ
description: "Questions about the demo."
section: extras
order: 20
---
# FAQ
## Does it migrate
Yes, run `./bin/demo migrate`, then `summer docs:sync` after a source change.
```text
summer not:checked in a text fence
```
```go src=modules/demo/never_test.go#never
_ = 1
```

View File

@@ -0,0 +1,11 @@
package demo_test
func Example_neverRun() {
neverRunHelper()
}
func neverRunHelper() {
// docs:start never
_ = 1
// docs:end never
}

View File

@@ -0,0 +1,3 @@
rule: snippet
file: docs/extras/faq.md
message: fragment is not inside a Test or Example function

View File

@@ -0,0 +1,22 @@
---
title: FAQ
description: "Questions about the demo."
section: extras
order: 20
---
# FAQ
## Does it migrate
Yes, run `./bin/demo migrate`, then `summer docs:sync` after a source change.
```text
summer not:checked in a text fence
```
- Greet:
```go src=modules/demo/example_test.go#ExampleHello
fmt.Println(demo.Hello("blog"))
// Output: Hello, blog
```

View File

@@ -0,0 +1,3 @@
rule: snippet
file: docs/extras/faq.md
message: modules/demo/example_test.go#ExampleHello: src= code block must be a top-level block

View File

@@ -0,0 +1,24 @@
# demo
Demo greets people by name.
```go
import "example.com/docfixture/modules/demo"
```
## Usage
Call `demo.Hello` or build a `demo.Greeter` and call `demo.Greeter.Greet`.
See the [start guide](../../docs/guide/start.md#install).
## Testing
```sh
go test ./modules/demo
```
```go src=modules/demo/example_test.go#ExampleHello
fmt.Println(demo.Hello("blog"))
// Output: Hello, blog
```

View File

@@ -0,0 +1,3 @@
rule: snippet
file: modules/demo/README.md
message: modules/demo/example_test.go#ExampleHello: module README code blocks are rendered as written

View File

@@ -0,0 +1,19 @@
---
title: FAQ
description: "Questions about the demo."
section: extras
order: 20
---
# FAQ
## Does it migrate
Yes, run `./bin/demo migrate`, then `summer docs:sync` after a source change.
```text
summer not:checked in a text fence
```
```go src=modules/demo/testdata/fixture_test.go#td
_ = 1
```

View File

@@ -0,0 +1,9 @@
package demo
import "testing"
func TestFixture(t *testing.T) {
// docs:start td
_ = 1
// docs:end td
}

View File

@@ -0,0 +1,3 @@
rule: snippet
file: docs/extras/faq.md
message: file is in a directory go test ./... skips