Documentation
¶
Overview ¶
Package errtest provides a go/analysis analyzer enforcing the gomatic error-testing shape in _test.go files: a table's error expectation is declared as the builtin error interface (wantErr error) and matched with errors.Is, never as a concrete sentinel type, a bool, or a message string, and never via testify's EqualError/ErrorContains message matching.
Scope: only test files are inspected. Expectation fields are struct fields whose name starts with want/expect (any case); typed sentinel INPUTS (e.g. a `sentinel errs.Const` field the test calls .With on) stay sanctioned, as do message expectations that do not name an error (plain `wantMsg string`).
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Analyzer = &analysis.Analyzer{ Name: "errtest", Doc: "reports test error expectations that are not wantErr error matched with errors.Is", Requires: []*analysis.Analyzer{inspect.Analyzer}, Run: run, }
Analyzer reports error expectations in test files that bypass the wantErr-error-plus-errors.Is shape.
var Registration = goyze.Registration{ Name: "errtest", Categories: []goyze.Category{"errors", "tests"}, URL: "https://docs.gomatic.dev/yze/errtest", Analyzer: Analyzer, }
Registration declares this analyzer to the yze framework.
Functions ¶
This section is empty.
Types ¶
This section is empty.
Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
yze-go-errtest
command
Command yze-go-errtest runs the errtest analyzer as a standalone go/analysis checker (text and -json output, and as a `go vet -vettool`).
|
Command yze-go-errtest runs the errtest analyzer as a standalone go/analysis checker (text and -json output, and as a `go vet -vettool`). |