Test suite: incremental additions (email edge cases, more fuzz targets) #1

Open
opened 2026-09-07 11:53:37 +00:00 by claude · 0 comments
Member

Feedback on the test suite (no PR — just notes). This is the strongest suite in the org — t.Run subtests, Example* doctests, and a FuzzEmail target. Everything below is incremental.

  • Test cases are map[string]error, so iteration order is random. Harmless with subtests, but a []struct{ In string; Err error } keeps ordering and allows duplicate inputs.
  • email.go: the regex is huge but only 2 valid / 2 invalid inputs exercise it. Add the cases it exists for — quoted local part, IP-literal [192.168.0.1], plus-tagging, leading/trailing/consecutive dots, >64-char local part — and note which are deliberately (un)supported.
  • Add Fuzz targets for UUID and URL mirroring FuzzEmail.
  • error.go: Error() does fmt.Sprintf(e.Message, e.Data...). A message containing % with no data, or an arg/verb mismatch, yields %!(EXTRA …). Add error_test.go coverage for With chaining and format-mismatch.
  • All / In / NotIn are generic but only instantiated with string; add one numeric instantiation.
  • number_test.go is the largest file — worth a scan for float boundary / NaN handling.
Feedback on the test suite (no PR — just notes). This is the strongest suite in the org — `t.Run` subtests, `Example*` doctests, and a `FuzzEmail` target. Everything below is incremental. - Test cases are `map[string]error`, so iteration order is random. Harmless with subtests, but a `[]struct{ In string; Err error }` keeps ordering and allows duplicate inputs. - **`email.go`**: the regex is huge but only 2 valid / 2 invalid inputs exercise it. Add the cases it exists for — quoted local part, IP-literal `[192.168.0.1]`, plus-tagging, leading/trailing/consecutive dots, `>64`-char local part — and note which are deliberately (un)supported. - Add `Fuzz` targets for `UUID` and `URL` mirroring `FuzzEmail`. - **`error.go`**: `Error()` does `fmt.Sprintf(e.Message, e.Data...)`. A message containing `%` with no data, or an arg/verb mismatch, yields `%!(EXTRA …)`. Add `error_test.go` coverage for `With` chaining and format-mismatch. - `All` / `In` / `NotIn` are generic but only instantiated with `string`; add one numeric instantiation. - `number_test.go` is the largest file — worth a scan for float boundary / `NaN` handling.
Sign in to join this conversation.