@@ -121,9 +121,9 @@ go test ./codegen/internal/... # Scanner and generator tests
121121go test ./internal/assertions -run TestEqual
122122
123123# Run with coverage
124- go test -cover ./internal/assertions # Should be 90%+
125- go test -cover ./assert # Should be ~100%
126- go test -cover ./require # Should be ~100%
124+ go test -cover ./internal/assertions # Should be 90%+
125+ go test -cover ./assert # Should be ~100%
126+ go test -cover ./require # Should be ~100%
127127go test -cover ./codegen/internal/scanner/... # Scanner tests
128128
129129# Run tests with verbose output
@@ -160,6 +160,11 @@ cd hack/doc-site/hugo
160160
161161** Example - Adding a new assertion:**
162162``` go
163+ import (
164+ " fmt"
165+ " strings"
166+ )
167+
163168// In internal/assertions/string.go
164169
165170// StartsWith asserts that the string starts with the given prefix.
@@ -168,16 +173,16 @@ cd hack/doc-site/hugo
168173//
169174// Examples:
170175//
171- // success: "hello world", "hello"
172- // failure: "hello world", "bye"
176+ // success: "hello world", "hello"
177+ // failure: "hello world", "bye"
173178func StartsWith (t T , str , prefix string , msgAndArgs ...any ) bool {
174- if h , ok := t.(H); ok {
175- h.Helper ()
176- }
177- if !strings.HasPrefix (str, prefix) {
178- return Fail (t, fmt.Sprintf (" Expected %q to start with %q " , str, prefix), msgAndArgs...)
179- }
180- return true
179+ if h , ok := t.(H); ok {
180+ h.Helper ()
181+ }
182+ if !strings.HasPrefix (str, prefix) {
183+ return Fail (t, fmt.Sprintf (" Expected %q to start with %q " , str, prefix), msgAndArgs...)
184+ }
185+ return true
181186}
182187```
183188
@@ -233,10 +238,10 @@ The generator reads "Examples:" sections from doc comments:
233238//
234239// Examples:
235240//
236- // success: 123, 123
237- // failure: 123, 456
241+ // success: 123, 123
242+ // failure: 123, 456
238243func Equal (t T , expected , actual any , msgAndArgs ...any ) bool {
239- // implementation
244+ // implementation
240245}
241246```
242247
@@ -297,10 +302,11 @@ To assign a function to a domain, add a domain tag in its doc comment:
297302// domain: equality
298303//
299304// Examples:
300- // success: 123, 123
301- // failure: 123, 456
305+ //
306+ // success: 123, 123
307+ // failure: 123, 456
302308func Equal (t T , expected , actual any , msgAndArgs ...any ) bool {
303- // implementation
309+ // implementation
304310}
305311```
306312
@@ -396,6 +402,12 @@ This layered approach ensures:
396402** This repository uses a signature testing pattern** based on Go 1.23's ` iter.Seq ` for all table-driven tests:
397403
398404``` go
405+ import (
406+ " iter"
407+ " slices"
408+ " testing"
409+ )
410+
399411// Define test case struct
400412type parseTestExamplesCase struct {
401413 name string
0 commit comments