diff options
author | Ivan Kohler <ivan@freeside.biz> | 2012-07-08 22:45:58 -0700 |
---|---|---|
committer | Ivan Kohler <ivan@freeside.biz> | 2012-07-08 22:45:58 -0700 |
commit | a6fe07e49e3fc12169e801b1ed6874c3a5bd8500 (patch) | |
tree | b87a7e6f37da5c8e13eb4d4653cfc8ce9239d8f0 /rt/t/api/emailparser.t | |
parent | e27244386c346f459d1569db26344407a0372a05 (diff) | |
parent | 005424d0c899aa899f43f583a6c74deb13ea4be1 (diff) |
Merge branch 'master' of git.freeside.biz:/home/git/freeside
Conflicts:
httemplate/misc/process/cancel_pkg.html
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; |