Commit Graph
8 Commits
Author SHA1 Message Date
aneurinandClaude Sonnet 5 a992065d6c email: validate with net/mail.ParseAddress
Replace the RFC 5322 mega-regexp with net/mail.ParseAddress, which is the
standard library's address parser and far easier to audit. A bare address
is required: inputs with a display name, angle brackets, a comment, or
trailing content are rejected, as is an address list.

Behaviour change: ParseAddress does not require the domain to contain a
dot, so "alice@localhost" now validates. Layer Match or a DNS lookup on
top if a stricter domain is needed.

Also rewrites FuzzEmail, which previously asserted that *every* input is
invalid, into checks that Email never returns an unexpected error type,
never panics, and gives a stable verdict.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-07 12:53:02 +00:00
Aneurin Barker Snook a9c1184d6b improve validate testing with examples
also simplified structure of test cases and failure logging
2024-07-18 06:53:20 +01:00
Aneurin Barker Snook db902e3c1c add validation error type, fix tests, add number tests 2023-11-19 20:27:33 +00:00
Aneurin Barker Snook 1cb434327a number tests 2023-10-08 16:20:21 +01:00
Aneurin Barker Snook 7cb1900ec1 standardise all validate tests 2023-10-08 15:21:02 +01:00
Aneurin Barker Snook 1a3c213dc1 make tests slightly easier to write 2023-10-07 10:44:47 +01:00
Aneurin Barker Snook 923734fe25 add min/max length validation, improve tests 2023-10-07 10:43:21 +01:00
Aneurin Barker Snook f41d6f248a add workspace, validation 2023-10-06 11:58:24 +01:00