Documentation
¶
Overview ¶
Command testdoublecheck checks, without Docker, that every test double and test-only access point of the module says what it is, next to its declaration. It reads Go syntax only (no type information), so it states what it can see and no more:
- every exported top-level declaration of a package listed in the testsupportcheck manifest's test_only_packages carries a "//testdouble:<class>" directive in its doc comment;
- every non-test declaration outside those packages whose comment says it exists for tests (a type, struct field, interface method, function or variable whose doc or trailing comment says, for example, "replaced in tests", "tests replace it" or "test-only"; the pattern is testComment) carries the directive. A seam without such a comment and without the directive is not found, and docs/contributing/test-double-inventory.md says so;
- every directive names a class of docs/contributing/test-double-inventory.md, once, in the doc comment of a declaration;
- no non-test file outside the test-only packages declares a type or function whose name contains fake, mock, stub or spy (case-insensitive): such doubles are _test.go declarations or live in a test-only package.
The harness_packages of the manifest hold integration test code that is outside _test.go files only so that several test packages can share it; they are read like _test.go files and not checked.
The class lives next to the declaration rather than in a table, so changes that add doubles in different packages do not edit a shared file. Package- local doubles in _test.go files are not checked: they are described by family in the inventory page.
Click to show internal directories.
Click to hide internal directories.