diff options
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; |