diff options
author | Ivan Kohler <ivan@freeside.biz> | 2012-04-24 11:35:56 -0700 |
---|---|---|
committer | Ivan Kohler <ivan@freeside.biz> | 2012-04-24 11:35:56 -0700 |
commit | 6587f6ba7d047ddc1686c080090afe7d53365bd4 (patch) | |
tree | ec77342668e8865aca669c9b4736e84e3077b523 /rt/t/api/emailparser.t | |
parent | 47153aae5c2fc00316654e7277fccd45f72ff611 (diff) |
first pass RT4 merge, RT#13852
Diffstat (limited to 'rt/t/api/emailparser.t')
-rw-r--r-- | rt/t/api/emailparser.t | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/rt/t/api/emailparser.t b/rt/t/api/emailparser.t index 940c26fde..790314603 100644 --- a/rt/t/api/emailparser.t +++ b/rt/t/api/emailparser.t @@ -2,7 +2,7 @@ use strict; use warnings; -use RT::Test tests => 4; +use RT::Test nodb => 1, tests => 10; RT->Config->Set( RTAddressRegexp => qr/^rt\@example.com$/i ); @@ -14,6 +14,23 @@ is(RT::EmailParser::IsRTAddress("","frt\@example.com"),undef, "Regexp didn't mat my @before = ("rt\@example.com", "frt\@example.com"); my @after = ("frt\@example.com"); -ok(eq_array(RT::EmailParser::CullRTAddresses("",@before),@after), "CullRTAddresses only culls RT addresses"); +ok(eq_array(RT::EmailParser->CullRTAddresses(@before),@after), "CullRTAddresses only culls RT addresses"); + +{ + require RT::Interface::Email; + my ( $addr, $name ) = + RT::Interface::Email::ParseAddressFromHeader('foo@example.com'); + is( $addr, 'foo@example.com', 'addr for foo@example.com' ); + is( $name, undef, 'no name for foo@example.com' ); + + ( $addr, $name ) = + RT::Interface::Email::ParseAddressFromHeader('Foo <foo@example.com>'); + is( $addr, 'foo@example.com', 'addr for Foo <foo@example.com>' ); + is( $name, 'Foo', 'name for Foo <foo@example.com>' ); + + ( $addr, $name ) = + RT::Interface::Email::ParseAddressFromHeader('foo@example.com (Comment)'); + is( $addr, 'foo@example.com', 'addr for foo@example.com (Comment)' ); + is( $name, undef, 'no name for foo@example.com (Comment)' ); +} -1; |