Giter Site home page Giter Site logo

Failing tests about email-validate-hs HOT 2 CLOSED

porges avatar porges commented on August 15, 2024
Failing tests

from email-validate-hs.

Comments (2)

Porges avatar Porges commented on August 15, 2024

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 characters

12345678901234567890123456789012345678901234567890123456789012345@example.com:
Should be False, got True
Local part more than 64 characters
""@example.com: Should be False, got True
Local part is effectively empty

x@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 hyphen

first.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 True

aaa@[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.

purefn avatar purefn commented on August 15, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.