Unit Tests

- Fixed broken unit test.
- Updated PUNCHLIST.
- Clarified task counting in helpers.cpp.
This commit is contained in:
Paul Beckingham 2011-09-12 01:38:35 -04:00
parent 082f7d703e
commit 157dad0026
3 changed files with 18 additions and 17 deletions

View file

@ -4,7 +4,6 @@ Beta1 Punch List
- Working merge command - Working merge command
- task.1 man page that is accurate - task.1 man page that is accurate
- taskrc.5 man page that is accurate - taskrc.5 man page that is accurate
- 42 or fewer failing unit tests (arbitrary non-zero number)
Beta 2/3 Punch List Beta 2/3 Punch List
- Task server integration - Task server integration

View file

@ -133,7 +133,6 @@ std::string onProjectChange (Task& task, bool scope /* = true */)
// Count pending and done tasks, for this project. // Count pending and done tasks, for this project.
int count_pending = 0; int count_pending = 0;
int count_done = 0; int count_done = 0;
std::vector <Task> all = context.tdb2.all_tasks (); std::vector <Task> all = context.tdb2.all_tasks ();
countTasks (all, project, count_pending, count_done); countTasks (all, project, count_pending, count_done);
@ -197,6 +196,8 @@ static void countTasks (
++count_done; ++count_done;
break; break;
case Task::deleted:
case Task::recurring:
default: default:
break; break;
} }

View file

@ -28,7 +28,7 @@
use strict; use strict;
use warnings; use warnings;
use Test::More tests => 6; use Test::More tests => 4;
# Create the rc file. # Create the rc file.
if (open my $fh, '>', 'bug.rc') if (open my $fh, '>', 'bug.rc')
@ -43,22 +43,23 @@ if (open my $fh, '>', 'bug.rc')
# Setup: Add a task and complete it # Setup: Add a task and complete it
qx{../src/task rc:bug.rc add One project:p1}; qx{../src/task rc:bug.rc add One project:p1};
# Delete the task and note the completion status of the project # Delete the task and note the completion status of the project.
my $output = qx{echo '-- y' | ../src/task rc:bug.rc 1 del}; my $output = qx{echo '-- y' | ../src/task rc:bug.rc 1 delete};
like ($output, qr/is 100\% complete/ms, 'Empty project correctly reported as being 100% completed.'); like ($output, qr/is 0\% complete/ms, '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};
$output = qx{../src/task rc:bug.rc 2 done};
like ($output, qr/is 100\% complete/ms, 'Empty project correctly reported as being 100% completed.');
# Cleanup. # Cleanup.
unlink 'pending.data'; unlink qw(pending.data completed.data undo.data backlog.data synch.key bug.rc);
ok (!-r 'pending.data', 'Removed pending.data'); ok (! -r 'pending.data' &&
! -r 'completed.data' &&
unlink 'completed.data'; ! -r 'undo.data' &&
ok (!-r 'completed.data', 'Removed completed.data'); ! -r 'backlog.data' &&
! -r 'synch.key' &&
unlink 'undo.data'; ! -r 'bug.rc', 'Cleanup');
ok (!-r 'undo.data', 'Removed undo.data');
unlink 'bug.rc';
ok (!-r 'bug.rc', 'Removed bug.rc');
exit 0; exit 0;