Unit Tests

- Enhanced the bug #956 tests to cover both supported methods of eliminating
  extraneous output from commands (redirect stderr, and verbose=nothing).
This commit is contained in:
Paul Beckingham 2012-09-16 15:16:32 -04:00
parent 9d1ae99656
commit c2ccd1b3ee

View file

@ -28,7 +28,7 @@
use strict;
use warnings;
use Test::More tests => 5;
use Test::More tests => 8;
# Create the rc file.
if (open my $fh, '>', 'bug.rc')
@ -43,14 +43,25 @@ if (open my $fh, '>', 'bug.rc')
qx{../src/task rc:bug.rc add test 2>&1};
my $output = qx{TASKRC=bug.rc ../src/task rc:bug.rc ids 2>&1};
unlike ($output, qr/TASKRC/ms, 'The header does not appear with "ids"');
# Solution 1: rc.verbose=nothing
my $output = qx{TASKRC=bug.rc ../src/task rc:bug.rc rc.verbose=nothing ids 2>&1};
unlike ($output, qr/TASKRC/ms, 'The header does not appear with "ids" (rc.verbose=nothing)');
$output = qx{TASKRC=bug.rc ../src/task uuids 2>&1};
unlike ($output, qr/TASKRC/ms, 'The header does not appear with "uuids"');
$output = qx{TASKRC=bug.rc ../src/task rc.verbose=nothing uuids 2>&1};
unlike ($output, qr/TASKRC/ms, 'The header does not appear with "uuids" (rc.verbose=nothing)');
$output = qx{TASKRC=bug.rc ../src/task _ids 2>&1};
unlike ($output, qr/TASKRC/ms, 'The header does not appear with "_ids"');
$output = qx{TASKRC=bug.rc ../src/task rc.verbose=nothing uuids 2>&1};
unlike ($output, qr/TASKRC/ms, 'The header does not appear with "uuids" (rc.verbose=nothing)');
# Solution 2: task ... 2>/dev/null
$output = qx{TASKRC=bug.rc ../src/task rc:bug.rc ids 2>/dev/null};
unlike ($output, qr/TASKRC/ms, 'The header does not appear with "ids" (2>/dev/null)');
$output = qx{TASKRC=bug.rc ../src/task _ids 2>/dev/null};
unlike ($output, qr/TASKRC/ms, 'The header does not appear with "_ids" (2>/dev/null)');
$output = qx{TASKRC=bug.rc ../src/task _ids 2>/dev/null};
unlike ($output, qr/TASKRC/ms, 'The header does not appear with "_ids" (2>/dev/null)');
### Cleanup.
unlink qw(pending.data completed.data undo.data backlog.data synch.key bug.rc);