From 11f47cb2ab26297e68761370bac905880b495f23 Mon Sep 17 00:00:00 2001 From: Jonathan Hall Date: Wed, 10 Sep 2014 08:55:17 -0500 Subject: [PATCH] Silence misc.t STDOUT by testing for it. --- t/misc.t | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/t/misc.t b/t/misc.t index 496f4e6..abcfd1e 100644 --- a/t/misc.t +++ b/t/misc.t @@ -1,4 +1,5 @@ -use Test::More tests => 12; +use Test::More tests => 14; +use Test::Output; use strict; use lib 't'; use_ok('Test::Qpsmtpd'); @@ -6,10 +7,21 @@ use_ok('Test::Qpsmtpd'); ok(my ($smtpd, $conn) = Test::Qpsmtpd->new_conn(), "get new connection"); # fault method -is(($smtpd->fault)->[0], 451, 'fault returns 451'); -is(($smtpd->fault("test message"))->[1], - "Internal error - try again later - test message", - 'returns the input message'); +{ + my $fault; + stderr_like { $fault = $smtpd->fault } + qr/program fault - command not performed \(No such file or directory\)/, + '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 \(No such file or directory\)/, + 'fault outputs proper custom warning to STDOUT'; + is($fault->[1], 'Internal error - try again later - test message', + 'returns the input message'); +}; # vrfy command is(($smtpd->command('VRFY '))[0], 252, 'VRFY command');