mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
Unit Tests
- Fixed broken unit test. - Updated PUNCHLIST. - Clarified task counting in helpers.cpp.
This commit is contained in:
parent
082f7d703e
commit
157dad0026
3 changed files with 18 additions and 17 deletions
|
@ -4,7 +4,6 @@ Beta1 Punch List
|
|||
- Working merge command
|
||||
- task.1 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
|
||||
- Task server integration
|
||||
|
|
|
@ -133,7 +133,6 @@ std::string onProjectChange (Task& task, bool scope /* = true */)
|
|||
// Count pending and done tasks, for this project.
|
||||
int count_pending = 0;
|
||||
int count_done = 0;
|
||||
|
||||
std::vector <Task> all = context.tdb2.all_tasks ();
|
||||
countTasks (all, project, count_pending, count_done);
|
||||
|
||||
|
@ -197,6 +196,8 @@ static void countTasks (
|
|||
++count_done;
|
||||
break;
|
||||
|
||||
case Task::deleted:
|
||||
case Task::recurring:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 6;
|
||||
use Test::More tests => 4;
|
||||
|
||||
# Create the rc file.
|
||||
if (open my $fh, '>', 'bug.rc')
|
||||
|
@ -43,22 +43,23 @@ if (open my $fh, '>', 'bug.rc')
|
|||
# Setup: Add a task and complete it
|
||||
qx{../src/task rc:bug.rc add One project:p1};
|
||||
|
||||
# Delete the task and note the completion status of the project
|
||||
my $output = qx{echo '-- y' | ../src/task rc:bug.rc 1 del};
|
||||
like ($output, qr/is 100\% complete/ms, 'Empty project correctly reported as being 100% completed.');
|
||||
# Delete the task and note the completion status of the project.
|
||||
my $output = qx{echo '-- y' | ../src/task rc:bug.rc 1 delete};
|
||||
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.
|
||||
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 '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;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue