Functional Weave
Code in Rust

validation.email@1.0.0

vectors.json

3,553 bytes · view raw

[
  { "name": "a plain address", "args": ["alice@example.com"], "expect": true },
  { "name": "a subdomain and a hyphen in the domain", "args": ["first.last@mail.example-corp.co.uk"], "expect": true },
  { "name": "plus addressing and the other atext specials", "args": ["user+tag_01!#$%&/=?^{|}~@example.org"], "expect": true },
  { "name": "case is preserved and irrelevant to acceptance", "args": ["Alice.Smith@Example.COM"], "expect": true },
  { "name": "the shortest address this accepts", "args": ["a@b.co"], "expect": true },
  { "name": "the empty string is not an address", "args": [""], "expect": false },
  { "name": "no at sign at all", "args": ["alice.example.com"], "expect": false },
  { "name": "two at signs, which no MTA will route", "args": ["alice@example@com"], "expect": false },
  { "name": "a space inside the local part", "args": ["alice smith@example.com"], "expect": false },
  { "name": "a leading space is not trimmed", "args": ["  alice@example.com"], "expect": false },
  { "name": "a domain with no dot is not deliverable from outside", "args": ["alice@localhost"], "expect": false },
  { "name": "consecutive dots in the local part", "args": ["alice..smith@example.com"], "expect": false },
  { "name": "a leading dot in the local part", "args": [".alice@example.com"], "expect": false },
  { "name": "a trailing dot on the domain leaves an empty label", "args": ["alice@example.com."], "expect": false },
  { "name": "a hyphen may not start a domain label", "args": ["alice@-example.com"], "expect": false },
  { "name": "an all-numeric top level domain is refused", "args": ["alice@example.123"], "expect": false },
  { "name": "a bracketed IP literal is out of scope", "args": ["alice@[192.168.0.1]"], "expect": false },
  { "name": "a quoted local part is out of scope", "args": ["\"alice smith\"@example.com"], "expect": false },
  { "name": "a single letter top level domain is refused", "args": ["alice@example.c"], "expect": false },
  { "name": "a non-ASCII local part is out of scope", "args": ["alicé@example.com"], "expect": false },
  { "name": "an empty domain", "args": ["alice@"], "expect": false },
  { "name": "an empty local part", "args": ["@example.com"], "expect": false },
  { "name": "sixty-four characters is the longest local part", "args": ["aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa@example.com"], "expect": true },
  { "name": "sixty-five characters is one too many", "args": ["aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa@example.com"], "expect": false },
  { "name": "a domain label may be sixty-three characters but not more", "args": ["alice@aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.com"], "expect": false },
  { "name": "two hundred and fifty-four characters is the longest address", "args": ["aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa@aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"], "expect": true },
  { "name": "two hundred and fifty-five characters is one too many", "args": ["aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa@aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"], "expect": false },
  { "name": "a non-string argument is not an address", "args": [42], "expect": false }
]