From 96624a115fe60b8ebdbbecbc2b38a7566d4e4c59 Mon Sep 17 00:00:00 2001 From: Frédéric Buclin Date: Mon, 23 Jan 2012 17:13:37 +0100 Subject: Bug 319953: Missing real email syntax check r=glob a=LpSolit --- t/007util.t | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 't') diff --git a/t/007util.t b/t/007util.t index e21ec28f8..a73f4dfa7 100644 --- a/t/007util.t +++ b/t/007util.t @@ -11,7 +11,7 @@ use lib 't'; use Support::Files; -use Test::More tests => 15; +use Test::More tests => 17; BEGIN { use_ok(Bugzilla); @@ -58,6 +58,16 @@ foreach my $input (keys %email_strings) { "email_filter('$input')"); } +# validate_email_syntax. We need to override some parameters. +my $params = Bugzilla->params; +$params->{emailregexp} = '.*'; +$params->{emailsuffix} = ''; +my $ascii_email = 'admin@company.com'; +# U+0430 returns the Cyrillic "а", which looks similar to the ASCII "a". +my $utf8_email = "\N{U+0430}dmin\@company.com"; +ok(validate_email_syntax($ascii_email), 'correctly formatted ASCII-only email address is valid'); +ok(!validate_email_syntax($utf8_email), 'correctly formatted email address with non-ASCII characters is rejected'); + # diff_arrays(): my @old_array = qw(alpha beta alpha gamma gamma beta alpha delta epsilon gamma); my @new_array = qw(alpha alpha beta gamma epsilon delta beta delta); -- cgit v1.2.3-24-g4f1b