Commit Graph
9 Commits
Author SHA1 Message Date
claudeandClaude Sonnet 5 164dcbf367 length: add MinLengthBytes / MaxLengthBytes
CI / test (pull_request) Successful in 34s
CI / test (push) Successful in 37s
MinLength/MaxLength now count runes, leaving no way to bound a string by
its byte size -- still wanted for fixed-width columns and wire-format
fields. Add the byte-counting pair alongside them, with their own "%d
bytes" sentinels (ErrMustHaveMoreBytes / ErrMustHaveFewerBytes).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-07 16:48:29 +01:00
claudeandClaude Sonnet 5 4e2e05c1b9 length: count runes, not bytes
CI / test (pull_request) Successful in 34s
MinLength/MaxLength measured len(value), so a string of 8 accented
characters (9+ bytes) failed MaxLength(8) despite the error message
promising "characters". Count with utf8.RuneCountInString so the check
matches the wording and the common-sense intent.

Still not grapheme-cluster aware (combining marks, emoji ZWJ sequences
count as several runes), which is out of scope for a stdlib-only helper.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-07 16:27:22 +01: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 40482060ac update all validation tests 2023-11-19 20:42:48 +00: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