Unit Tests

- Upgraded to use the new template.
This commit is contained in:
Paul Beckingham 2014-08-24 21:09:19 -04:00
parent f7e5653199
commit 959d59d48d

View file

@ -33,8 +33,12 @@ use Test::More tests => 2;
delete $ENV{'TASKDATA'};
delete $ENV{'TASKRC'};
use File::Basename;
my $ut = basename ($0);
my $rc = $ut . '.rc';
# Create the rc file.
if (open my $fh, '>', 'bug.rc')
if (open my $fh, '>', $rc)
{
print $fh "data.location=.\n",
"confirmation=off\n";
@ -44,18 +48,18 @@ if (open my $fh, '>', 'bug.rc')
# Bug #605 - project count zero bug?
# Setup: Add a task and complete it
qx{../src/task rc:bug.rc add One project:p1 2>&1};
qx{../src/task rc:$rc add One project:p1 2>&1};
# Delete the task and note the completion status of the project.
my $output = qx{echo 'y' | ../src/task rc:bug.rc 1 delete 2>&1 >/dev/null};
like ($output, qr/is 0\% complete/ms, 'Empty project correctly reported as being 0% completed.');
my $output = qx{echo 'y' | ../src/task rc:$rc 1 delete 2>&1 >/dev/null};
like ($output, qr/is 0\% complete/ms, "$ut: Empty project correctly reported as being 0% completed.");
# Add another task, complete it and note the completion status of hte project.
qx{../src/task rc:bug.rc add Two project:p1 2>&1};
$output = qx{../src/task rc:bug.rc 2 done 2>&1 >/dev/null};
like ($output, qr/is 100\% complete/ms, 'Empty project correctly reported as being 100% completed.');
qx{../src/task rc:$rc add Two project:p1 2>&1};
$output = qx{../src/task rc:$rc 2 done 2>&1 >/dev/null};
like ($output, qr/is 100\% complete/ms, "$ut: Empty project correctly reported as being 100% completed.");
# Cleanup.
unlink qw(pending.data completed.data undo.data backlog.data bug.rc);
unlink qw(pending.data completed.data undo.data backlog.data), $rc;
exit 0;