test(email): expand is_idn_email coverage for the address-literal branch - #2698
Open
vtushar06 wants to merge 1 commit into
Open
test(email): expand is_idn_email coverage for the address-literal branch#2698vtushar06 wants to merge 1 commit into
vtushar06 wants to merge 1 commit into
Conversation
Signed-off-by: Tushar Verma <tusharmyself06@gmail.com>
🤖 Augment PR SummarySummary: Expands test coverage for the RFC 5321 address-literal branch in Changes:
Notes: This PR is test-only (coverage expansion); expectations are pinned to RFC-defined behavior and were cross-checked against current Core behavior. 🤖 Was this summary useful? React with 👍 or 👎 |
jviotti
reviewed
Jul 31, 2026
| EXPECT_FALSE(sourcemeta::core::is_email("\xf3\xb0\x80\x80@example.com")); | ||
| } | ||
|
|
||
| // --- Quoted-string structure ----------------------------------------------- |
Member
There was a problem hiding this comment.
Can you remove section comments?
jviotti
requested changes
Jul 31, 2026
jviotti
left a comment
Member
There was a problem hiding this comment.
Looks good, but there are still lots of section comments!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I added 39 tests to
idn_email_test.cccovering the address-literal branch ofis_idn_email. Core already passes all of them, so this is coverage, not a fix.What is new: the branch had almost nothing behind it.
is_general_address_literalhad no tests at all, andis_snum's leading-zero behaviour - the thing that separates it from the RFC 3986 dec-octet behindis_ipv4- was not pinned anywhere, despite being called out in a comment.Snum(13 tests): leading zeros in each position, padded zero octets, the 255 maximum, one over, four digits, wrong octet counts, and the dot-placement errors.General-address-literal(9 tests): thetag:contentform, the shortest valid form, a leading-hyphen tag, a trailing-hyphen tag, empty tag and empty content, and thedcontentexclusions for SP and[.IPV6:tag,IPv6v4-comp,IPv6v4-full, and the empty payload.@delimiter (2 tests): U+FF20 and U+FE6B, neither of which is the delimiter.UTF8-non-asciiwith no property filter.How I checked the expected values: every input was run against the built
is_idn_emailandis_emailbefore being written, and each expectation is the RFC verdict rather than the observed one - the two agreed on all 43 candidates I probed.sourcemeta_core_email_unitis 393 passed / 0 failed with these added.Two of my initial expectations were wrong and Core was right, which is worth recording.
user@[-tag:abc]is valid, becauseLdh-str = *( ALPHA / DIGIT / "-" ) Let-digonly constrains the last character, unlikesub-domain = Let-dig [Ldh-str]. Anduser@[IPv4:192.0.2.1]is a syntactically valid General-address-literal, sinceIPv4is not a tag RFC 5321 defines. Both are now tests with the reasoning in the comment.RFC references:
Snum,dcontent,General-address-literal, the IPv6 forms): https://www.rfc-editor.org/rfc/rfc5321#section-4.1.3Mailbox,Ldh-str,Quoted-string,quoted-pairSMTP): https://www.rfc-editor.org/rfc/rfc5321#section-4.1.2IPv6:tag matches in any case): https://www.rfc-editor.org/rfc/rfc5234#section-2.3UTF8-non-ascii, for the local-part code-point tests): https://www.rfc-editor.org/rfc/rfc6532#section-3.1