Unit Tests

- Improved the signal to noise ratio for unit tests.
This commit is contained in:
Paul Beckingham 2011-09-08 22:51:17 -04:00
parent 38c325d469
commit a297756ff0
2 changed files with 17 additions and 37 deletions

View file

@ -28,7 +28,7 @@
use strict;
use warnings;
use Test::More tests => 42;
use Test::More tests => 37;
# Create the rc file.
if (open my $fh, '>', 'bug.rc')
@ -87,7 +87,7 @@ qx{../src/task rc:bug.rc 2 modify +\@2};
qx{../src/task rc:bug.rc 3 modify +\@3};
$output = qx{../src/task rc:bug.rc list -\@1};
unlike ($output, qr/one/, 'Single: no @1');
unlike ($output, qr/one/, 'Single: no @1'); # 19
like ($output, qr/two/, 'Single: yes @2');
like ($output, qr/three/, 'Single: yes @3');
@ -122,22 +122,12 @@ unlike ($output, qr/two/, 'Triple: no @foo.2');
unlike ($output, qr/three/, 'Triple: no @foo.3');
# 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' &&
! -r 'bug.rc', 'Cleanup');
exit 0;

View file

@ -28,7 +28,7 @@
use strict;
use warnings;
use Test::More tests => 87;
use Test::More tests => 82;
# Create the rc file.
if (open my $fh, '>', 'countdown.rc')
@ -175,22 +175,12 @@ like ($output, qr/\bthree\b.+\btwo/ms, 'downc: three < two');
like ($output, qr/\btwo\b.+\bone\b/ms, 'downc: two < one');
# 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 'countdown.rc';
ok (!-r 'countdown.rc', 'Removed countdown.rc');
unlink qw(pending.data completed.data undo.data backlog.data synch.key countdown.rc);
ok (! -r 'pending.data' &&
! -r 'completed.data' &&
! -r 'undo.data' &&
! -r 'backlog.data' &&
! -r 'synch.key' &&
! -r 'countdown.rc', 'Cleanup');
exit 0;