]> git.giacomolli.uk - onechat/commitdiff
Name the test files that hold only shared helpers
authorAnderson A. Giacomolli <agiacomolli@gmail.com>
Sat, 7 Nov 2026 17:57:37 +0000 (14:57 -0300)
committerAnderson A. Giacomolli <agiacomolli@gmail.com>
Sat, 7 Nov 2026 17:57:37 +0000 (14:57 -0300)
A helper that one test file uses stays in that file. A helper that more
than one test file uses goes into a file without tests, whose name says
what it holds and ends with _helper_test.go. The name then shows that
the file has no tests, and a file named for one type does not seem to
test a feature of that name.

.agents/skills/go-code/SKILL.md

index edaf3770e2aee6b0619f27b7f29b00c31e2d0186..3d9e3f31d8b9c0cd299341119392139031046074 100644 (file)
@@ -92,5 +92,8 @@ description: Go style rules. Use before you write or review Go code.
   input.
 - In a test file, put constants immediately after the imports, then the
   tests, then supporting types, methods, and helpers.
   input.
 - In a test file, put constants immediately after the imports, then the
   tests, then supporting types, methods, and helpers.
+- Keep a helper that only one test file uses in that file. Put a helper
+  that more than one test file uses in a file without tests. Name that
+  file for what it holds, and end the name with `_helper_test.go`.
 - Supply valid required dependencies in tests. Do not make a dependency
   optional only to make a test simpler.
 - Supply valid required dependencies in tests. Do not make a dependency
   optional only to make a test simpler.