test(11.1-06): plant one fixture per docs checker rule and run them in the gate
- testdata/clean passes every check; 63 violation cases each overlay one fault and a want.txt naming the single problem it must produce - TestPlantedViolations also plants the forbidden name (split literals) and symlink escapes at run time; TestBuildOutputGuard covers --out - check-phase11.1.sh --self-test runs the corpus through a go test -json detector that refuses FAIL, SKIP, zero tests and no tests to run - the self-test scratch copy now carries examples/ and README.md, so its baseline sees the example command literals the real tree sees
This commit is contained in:
19
internal/docsite/testdata/clean/modules/demo/README.md
vendored
Normal file
19
internal/docsite/testdata/clean/modules/demo/README.md
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
# 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
|
||||
```
|
||||
17
internal/docsite/testdata/clean/modules/demo/demo.go
vendored
Normal file
17
internal/docsite/testdata/clean/modules/demo/demo.go
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
// Package demo is the docs checker fixture module.
|
||||
package demo
|
||||
|
||||
// Hello returns a greeting for name.
|
||||
func Hello(name string) string {
|
||||
return "Hello, " + name
|
||||
}
|
||||
|
||||
// Greeter greets by name.
|
||||
type Greeter struct {
|
||||
Name string
|
||||
}
|
||||
|
||||
// Greet returns the greeting for the greeter's name.
|
||||
func (g Greeter) Greet() string {
|
||||
return Hello(g.Name)
|
||||
}
|
||||
13
internal/docsite/testdata/clean/modules/demo/demo_test.go
vendored
Normal file
13
internal/docsite/testdata/clean/modules/demo/demo_test.go
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
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)
|
||||
}
|
||||
}
|
||||
12
internal/docsite/testdata/clean/modules/demo/example_test.go
vendored
Normal file
12
internal/docsite/testdata/clean/modules/demo/example_test.go
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
package demo_test
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"example.com/docfixture/modules/demo"
|
||||
)
|
||||
|
||||
func ExampleHello() {
|
||||
fmt.Println(demo.Hello("blog"))
|
||||
// Output: Hello, blog
|
||||
}
|
||||
Reference in New Issue
Block a user