Unit Tests

- Minor bug fixes.
This commit is contained in:
Paul Beckingham 2011-09-05 01:48:25 -04:00
parent e2d0126415
commit d1bc46c355
4 changed files with 34 additions and 54 deletions

View file

@ -28,15 +28,15 @@
use strict;
use warnings;
use Test::More tests => 10;
use Test::More tests => 5;
# Create the rc file.
if (open my $fh, '>', 'bug_concat.rc')
if (open my $fh, '>', 'bug.rc')
{
print $fh "data.location=.\n",
"confirmation=no\n";
close $fh;
ok (-r 'bug_concat.rc', 'Created bug_concat.rc');
ok (-r 'bug.rc', 'Created bug.rc');
}
# When a task is modified like this:
@ -47,12 +47,12 @@ if (open my $fh, '>', 'bug_concat.rc')
#
# Thisisanewdescription
qx{../src/task rc:bug_concat.rc add This is the original text};
my $output = qx{../src/task rc:bug_concat.rc info 1};
qx{../src/task rc:bug.rc add This is the original text};
my $output = qx{../src/task rc:bug.rc info 1};
like ($output, qr/Description\s+This is the original text/, 'original correct');
qx{../src/task rc:bug_concat.rc 1 modify This is the modified text};
$output = qx{../src/task rc:bug_concat.rc info 1};
qx{../src/task rc:bug.rc 1 modify This is the modified text};
$output = qx{../src/task rc:bug.rc info 1};
like ($output, qr/Description\s+This is the modified text\n/, 'modified correct');
# When a task is added like this:
@ -63,28 +63,18 @@ like ($output, qr/Description\s+This is the modified text\n/, 'modified correct'
#
# aaabbb:ccc ddd
qx{../src/task rc:bug_concat.rc add aaa bbb:ccc ddd};
$output = qx{../src/task rc:bug_concat.rc info 2};
qx{../src/task rc:bug.rc add aaa bbb:ccc ddd};
$output = qx{../src/task rc:bug.rc info 2};
like ($output, qr/Description\s+aaa bbb:ccc ddd\n/, 'properly concatenated');
# 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_concat.rc';
ok (!-r 'bug_concat.rc', 'Removed bug_concat.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;