Merge pull request #87 from flimzy/misc-tests
Silence misc.t STDOUT by testing for it.
This commit is contained in:
commit
8f8463e91e
@ -7,6 +7,7 @@ WriteMakefile(
|
|||||||
NAME => 'qpsmtpd',
|
NAME => 'qpsmtpd',
|
||||||
VERSION_FROM => 'lib/Qpsmtpd.pm',
|
VERSION_FROM => 'lib/Qpsmtpd.pm',
|
||||||
PREREQ_PM => {
|
PREREQ_PM => {
|
||||||
|
'Test::Output' => 0,
|
||||||
'Data::Dumper' => 0,
|
'Data::Dumper' => 0,
|
||||||
'Date::Parse' => 0,
|
'Date::Parse' => 0,
|
||||||
'File::Temp' => 0,
|
'File::Temp' => 0,
|
||||||
|
22
t/misc.t
22
t/misc.t
@ -1,4 +1,5 @@
|
|||||||
use Test::More tests => 12;
|
use Test::More tests => 14;
|
||||||
|
use Test::Output;
|
||||||
use strict;
|
use strict;
|
||||||
use lib 't';
|
use lib 't';
|
||||||
use_ok('Test::Qpsmtpd');
|
use_ok('Test::Qpsmtpd');
|
||||||
@ -6,10 +7,21 @@ use_ok('Test::Qpsmtpd');
|
|||||||
ok(my ($smtpd, $conn) = Test::Qpsmtpd->new_conn(), "get new connection");
|
ok(my ($smtpd, $conn) = Test::Qpsmtpd->new_conn(), "get new connection");
|
||||||
|
|
||||||
# fault method
|
# fault method
|
||||||
is(($smtpd->fault)->[0], 451, 'fault returns 451');
|
{
|
||||||
is(($smtpd->fault("test message"))->[1],
|
my $fault;
|
||||||
"Internal error - try again later - test message",
|
stderr_like { $fault = $smtpd->fault }
|
||||||
'returns the input message');
|
qr/program fault - command not performed \(/,
|
||||||
|
'fault outputs proper warning to STDOUT';
|
||||||
|
is($fault->[0], 451, 'fault returns 451');
|
||||||
|
};
|
||||||
|
{
|
||||||
|
my $fault;
|
||||||
|
stderr_like { $fault = $smtpd->fault('test message') }
|
||||||
|
qr/test message \(/,
|
||||||
|
'fault outputs proper custom warning to STDOUT';
|
||||||
|
is($fault->[1], 'Internal error - try again later - test message',
|
||||||
|
'returns the input message');
|
||||||
|
};
|
||||||
|
|
||||||
# vrfy command
|
# vrfy command
|
||||||
is(($smtpd->command('VRFY <foo@bar>'))[0], 252, 'VRFY command');
|
is(($smtpd->command('VRFY <foo@bar>'))[0], 252, 'VRFY command');
|
||||||
|
Loading…
Reference in New Issue
Block a user