Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Email-Valid CPAN distribution.

Report information
The Basics
Id: 19652
Status: resolved
Priority: 0/
Queue: Email-Valid

People
Owner: Nobody in particular
Requestors: rjbs [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 0.15
Fixed in: (no value)



Subject: modernize and improve tests
The attached file improves the test suite by updating it ot use Test:More and provide diagnostics. Further, it skips the MX tests if a known good domain cannot be resolved. -- rjbs
Subject: valid.t
#!perl use strict; use Test::More tests => 12; BEGIN { use_ok('Email::Valid'); } my $v = Email::Valid->new; ok( ! $v->address('Alfred Neuman <Neuman@BBN-TENEXA>'), 'Alfred Neuman <Neuman@BBN-TENEXA>', ); ok( $v->address( -address => 'Alfred Neuman <Neuman@BBN-TENEXA>', -fqdn => 0), 'Alfred Neuman <Neuman@BBN-TENEXA> { -fqdn => 0 }', ); is( $v->address( -address => 'first last@aol.com', -fudge => 1), 'firstlast@aol.com', "spaces fudged out of an address local-part", ); ok( ! $v->address( -address => 'first last@aol.com', -fudge => 0), "spaces in localpart is not valid when not fudging", ); is($v->details, 'rfc822', "details are rfc822"); is( $v->address('foo @ foo.com'), 'foo@foo.com', "spaced out address is squished" ); is( $v->address(q{fred&barney@stonehenge(yup, the rock place).(that's dot)com}), 'fred&barney@stonehenge.com', "comments nicely dropped from an address", ); SKIP: { skip "your dns appears missing or failing to resolve", 2 unless $v->address(-address=> 'devnull@pobox.com', -mxcheck => 1); ok( $v->address(-address => 'blort@aol.com', -mxcheck => 1), 'blort@aol.com, with mxcheck, is ok', ); ok( !$v->address(-address => 'blort@will-never-exist.pobox.com', -mxcheck => 1), 'blort@will-never-exist.pobox.com, with mxcheck, is invalid', ); } SKIP: { skip "tests require Net::Domain::TLD", 2 unless eval { require Net::Domain::TLD; 1; }; ok( $v->address( -address => 'blort@notarealdomainfoo.com', -tldcheck => 1), 'blort@notarealdomainfoo.com is ok with tldcheck', ); ok( $v->address( -address => 'blort@notarealdomainfoo.bla', -tldcheck => 1), 'blort@notarealdomainfoo.bla is not ok with tldcheck', ); }