Unit Tests

- Added unit tests for bug 819, on behalf of Matt Kraai.
- Created a new, single test for cleanup that replaces 6.  It's makes
  for shorter unit tests, and adds less test count inflation.  Over
  time, all tests should be modified in a similar way.  This will
  probably cut the total number of unit tests in half, but that's not
  the important metric.
This commit is contained in:
Paul Beckingham 2011-08-26 02:13:32 -04:00
parent ea3f0e8567
commit 64be6e1cf4
3 changed files with 72 additions and 36 deletions

View file

@ -28,7 +28,7 @@
use strict;
use warnings;
use Test::More tests => 11;
use Test::More tests => 6;
# Create the rc file.
if (open my $fh, '>', 'bug.rc')
@ -68,23 +68,13 @@ $output = qx{../src/task rc:bug.rc 7-9 del};
like ($output, qr/Project 'p1' is 75% complete \(1 of 4 tasks remaining\)\./ms, 'Project counts correct for a multiple delete');
# Cleanup.
unlink 'pending.data';
ok (!-r 'pending.data', 'Removed pending.data');
unlink 'completed.data';
ok (!-r 'completed.data', 'Removed completed.data');
unlink 'undo.data';
ok (!-r 'undo.data', 'Removed undo.data');
unlink 'backlog.data';
ok (!-r 'backlog.data', 'Removed backlog.data');
unlink 'synch.key';
ok (!-r 'synch.key', 'Removed synch.key');
unlink 'bug.rc';
ok (!-r 'bug.rc', 'Removed bug.rc');
unlink qw(pending.data completed.data undo.data backlog.data synch.key bug.rc);
ok (! -r 'pending.data' &&
! -r 'completed.data' &&
! -r 'undo.data' &&
! -r 'backlog.data' &&
! -r 'synch_key.data' &&
! -r 'bug.rc', 'Cleanup');
exit 0;