add tests for single character domains

git-svn-id: https://svn.perl.org/qpsmtpd/trunk@317 958fd67b-6ff1-0310-b445-bb7760255be9
This commit is contained in:
Ask Bjørn Hansen 2004-09-14 19:34:19 +00:00
parent 8c37005161
commit eadaaf217c
2 changed files with 20 additions and 2 deletions

View File

@ -19,3 +19,12 @@ my $command = 'MAIL FROM:<ask@perl.org> SIZE=1230';
is(($smtpd->command($command))[0], 250, $command); is(($smtpd->command($command))[0], 250, $command);
is($smtpd->transaction->sender->format, '<ask@perl.org>', 'got the right sender'); is($smtpd->transaction->sender->format, '<ask@perl.org>', 'got the right sender');
my $command = 'MAIL FROM:<>';
is(($smtpd->command($command))[0], 250, $command);
is($smtpd->transaction->sender->format, '<>', 'got the right sender');
my $command = 'MAIL FROM:<ask@p.qpsmtpd-test.askask.com> SIZE=1230';
is(($smtpd->command($command))[0], 250, $command);
is($smtpd->transaction->sender->format, '<ask@p.qpsmtpd-test.askask.com>', 'got the right sender');

View File

@ -1,8 +1,8 @@
#!/usr/bin/perl #!/usr/bin/perl
use strict; use strict;
use warnings; $^W = 1;
use Test::More tests => 20; use Test::More tests => 24;
BEGIN { BEGIN {
use_ok('Qpsmtpd::Address'); use_ok('Qpsmtpd::Address');
@ -63,6 +63,15 @@ $ao = Qpsmtpd::Address->new($as);
ok ($ao, "new $as"); ok ($ao, "new $as");
is ($ao->address, 'foo@example.com', "address $as"); is ($ao->address, 'foo@example.com', "address $as");
$as = '<foo@foo.x.example.com>';
$ao = Qpsmtpd::Address->new($as);
ok ($ao, "new $as");
is ($ao->format, $as, "format $as");
$as = 'foo@foo.x.example.com';
ok ($ao = Qpsmtpd::Address->parse($as), "parse $as");
is ($ao && $ao->address, $as, "address $as");
# Not sure why we can change the address like this, but we can so test it ... # Not sure why we can change the address like this, but we can so test it ...
is ($ao->address('test@example.com'), 'test@example.com', 'address(test@example.com)'); is ($ao->address('test@example.com'), 'test@example.com', 'address(test@example.com)');