Comments (2)
Hi Richard,
This is basically by design. The tests aren't really unit tests for the
module but are lifted from Dominic Sayer's PHP code. (
http://code.google.com/p/isemail/)
Since this package validates according to the email RFC (5322), the tests that
fail come in two categories:
- the RFC specifies a very loose validation on the format of the
domain-part - Dominic's tests are more strict and enforce rules from
various other RFCs - there is no such thing as length limits, which are actually a requirement
of SMTP.
The odd one out is the test for the empty local part. Dominic suggested
that this should be disallowed, but I wanted the module to match the
requirements of the RFC exactly,so this is parsed as a valid email. There's
no reason an email server couldn't accept ""@example.com if it's willing to
accept ""@example.com! :)
I have wanted to add another package which would parse any manner of domain
name, and have the email address validator pass off to this for the
domain-part, but have not had time to yet.
Overall length limits could potentially be added as an option to this
package.
George
On 24 November 2012 13:48, Richard Wallace [email protected] wrote:
I want to work on making the input type more generic (I'm working with
Data.Text and not String and don't want to have to convert back and
forth), but discovered that many of the tests are failing.123456789012345678901234567890123456789012345678901234567890@12345678901234567890123456789012345678901234567890123456789.12345678901234567890123456789012345678901234567890123456789.12345678901234567890123456789012345678901234567890123456789.1234.example.com:
Should be False, got True
Entire address is longer than 256 characters12345678901234567890123456789012345678901234567890123456789012345@example.com:
Should be False, got True
Local part more than 64 characters
""@example.com: Should be False, got True
Local part is effectively emptyx@x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x23456:
Should be False, got True
Domain exceeds 255 chars
first.last@[.12.34.56.78]: Should be False, got True
Only char that can precede IPv4 address is ':'
first.last@[12.34.56.789]: Should be False, got True
Can't be interpreted as IPv4 so IPv6 tag is missing
first.last@[::12.34.56.78]: Should be False, got True
IPv6 tag is missing
first.last@[IPv5:::12.34.56.78]: Should be False, got True
IPv6 tag is wrong
first.last@[IPv6:1111:2222:3333::4444:5555:12.34.56.78]: Should be False,
got True
Too many IPv6 groups (4 max)
first.last@[IPv6:1111:2222:3333:4444:5555:12.34.56.78]: Should be False,
got True
Not enough IPv6 groups
first.last@[IPv6:1111:2222:3333:4444:5555:6666:7777:12.34.56.78]: Should
be False, got True
Too many IPv6 groups (6 max)
first.last@[IPv6:1111:2222:3333:4444:5555:6666:7777]: Should be False,
got True
Not enough IPv6 groups
first.last@[IPv6:1111:2222:3333:4444:5555:6666:7777:8888:9999]: Should be
False, got True
Too many IPv6 groups (8 max)
first.last@[IPv6:1111:2222::3333::4444:5555:6666]: Should be False, got
True
Too many '::' (can be none or one)
first.last@[IPv6:1111:2222:3333::4444:5555:6666:7777]: Should be False,
got True
Too many IPv6 groups (6 max)
first.last@[IPv6:1111:2222:333x::4444:5555]: Should be False, got True
x is not valid in an IPv6 address
first.last@[IPv6:1111:2222:33333::4444:5555]: Should be False, got True
33333 is not a valid group in an IPv6 address
[email protected]: Should be False, got True
TLD can't be all digits
first.last@com: Should be False, got True
Mail host must be second- or lower level
[email protected]: Should be False, got True
Label can't begin with a hyphen
[email protected]: Should be False, got True
Label can't end with a hyphenfirst.last@x234567890123456789012345678901234567890123456789012345678901234.example.com:
Should be False, got True
Label can't be longer than 63 octets
[email protected]: Should be False, got True
Top Level Domain won't be all-numeric (see RFC3696 Section 2). I disagree
with Dave Child on this one.test@123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012.com:
Should be False, got True
255 characters is maximum length for domain. This is 256.
test@example: Should be False, got True
Dave Child says so
first.""[email protected]: Should be False, got True
Contains a zero-length element
first.last@[IPv6:1111:2222:3333:4444:5555:6666:12.34.567.89]: Should be
False, got True
IPv4 part contains an invalid octet
a@b: Should be False, got Trueaaa@[123.123.123.333]: Should be False, got True
not a valid IP
a@bar: Should be False, got True[email protected]: Should be False, got True
[email protected]: Should be False, got True
[email protected]: Should be False, got True
[email protected]: Should be False, got True
ip need to be []—
Reply to this email directly or view it on GitHubhttps://github.com//issues/2.
from email-validate-hs.
Ok, thanks for the explanation. It would be nice to have a more strict version that follows the various RFCs, but it's not really critical for my immediate needs either.
from email-validate-hs.
Related Issues (20)
- Create a joint test suite with hsemail HOT 2
- Why does Text.Email.Parser call a parser on its intermediate results? HOT 5
- quasiquoter? HOT 3
- Cabal homepage URL is returning a 404 HOT 2
- Consider adding PathPiece instance? HOT 3
- Major version changes (v3) HOT 4
- Add NFData and Binary instances to EmailAddress HOT 2
- Allow testing with doctest-0.15 HOT 4
- Allow testing with hspec-2.5 HOT 1
- Use case-insensitive ByteString in EmailAddress HOT 2
- Quotes-wrapped `Show` intentional? HOT 3
- Zero width characters
- Status of v3 and offer of help HOT 1
- Please relax version constraint on 'template-haskell' to support ghc-8.10.1 HOT 2
- Fail on dotless domain names
- testsuite failing in Stackage Nightly HOT 4
- The package is disabled in Stackage HOT 4
- Create EmailAdress or validate String HOT 1
- canonicalizeEmail removes spaces inside emails HOT 3
- hspec-2.11 not accepted
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from email-validate-hs.