From eadaaf217cad2abe14a27b230ed7d3d894d73bed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ask=20Bj=C3=B8rn=20Hansen?= Date: Tue, 14 Sep 2004 19:34:19 +0000 Subject: [PATCH] add tests for single character domains git-svn-id: https://svn.perl.org/qpsmtpd/trunk@317 958fd67b-6ff1-0310-b445-bb7760255be9 --- t/addresses.t | 9 +++++++++ t/qpsmtpd-address.t | 13 +++++++++++-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/t/addresses.t b/t/addresses.t index 6805342..c19b586 100644 --- a/t/addresses.t +++ b/t/addresses.t @@ -19,3 +19,12 @@ my $command = 'MAIL FROM: SIZE=1230'; is(($smtpd->command($command))[0], 250, $command); is($smtpd->transaction->sender->format, '', '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: SIZE=1230'; +is(($smtpd->command($command))[0], 250, $command); +is($smtpd->transaction->sender->format, '', 'got the right sender'); + + diff --git a/t/qpsmtpd-address.t b/t/qpsmtpd-address.t index c69b567..819a424 100644 --- a/t/qpsmtpd-address.t +++ b/t/qpsmtpd-address.t @@ -1,8 +1,8 @@ #!/usr/bin/perl use strict; -use warnings; +$^W = 1; -use Test::More tests => 20; +use Test::More tests => 24; BEGIN { use_ok('Qpsmtpd::Address'); @@ -63,6 +63,15 @@ $ao = Qpsmtpd::Address->new($as); ok ($ao, "new $as"); is ($ao->address, 'foo@example.com', "address $as"); +$as = ''; +$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 ... is ($ao->address('test@example.com'), 'test@example.com', 'address(test@example.com)');