- Fixed bug #837, which caused incorrect urgency calculations for tasks that
  have completed dependencies, and problems when editing those tasks (thanks
  to Matt Kraai).
- Added Task::addDependency (const std::string&) method for reconstructing
  dependencies on tasks with no ID.
- Modfified Task::urgency_blocked so that it considers the blocking task's
  status.  This is an expensive test, and so it is wrapped by a cheaper test
  to see if there are/were any dependencies at all.  This means that urgency
  calculations are not slowed for tasks without dependencies, and is slower
  but more accurate for tasks that do have dependencies.
- Modified edit command so that dependencies are shown as IDs or UUIDs
  depending on whether the task is pending or not.
- Modified edit command so that dependencies are parsed as IDs or UUIDs
  depending on whether the task is pending or not.
- Modified wording in the template of the edit command to reflect the above.
- Added unit tests bug.837.t.
This commit is contained in:
Paul Beckingham 2012-03-04 00:05:11 -05:00
parent 1582fb1f88
commit 77200d7eb4
6 changed files with 142 additions and 7 deletions

69
test/bug.837.t Executable file
View file

@ -0,0 +1,69 @@
#! /usr/bin/perl
################################################################################
## taskwarrior - a command line task list manager.
##
## Copyright 2006-2012, Paul Beckingham, Federico Hernandez.
##
## Permission is hereby granted, free of charge, to any person obtaining a copy
## of this software and associated documentation files (the "Software"), to deal
## in the Software without restriction, including without limitation the rights
## to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
## copies of the Software, and to permit persons to whom the Software is
## furnished to do so, subject to the following conditions:
##
## The above copyright notice and this permission notice shall be included
## in all copies or substantial portions of the Software.
##
## THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
## OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
## FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
## THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
## LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
## OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
## SOFTWARE.
##
## http://www.opensource.org/licenses/mit-license.php
##
################################################################################
use strict;
use warnings;
use Test::More tests => 5;
# Create the rc file.
if (open my $fh, '>', 'bug.rc')
{
print $fh "data.location=.\n";
close $fh;
ok (-r 'bug.rc', 'Created bug.rc');
}
# Bug 837: When a task is completed, tasks that depended upon it don't have
# correct urgency and depend on 0 when edited
qx{../src/task rc:bug.rc add one};
qx{../src/task rc:bug.rc add two dep:1};
my $output = qx{../src/task rc:bug.rc long};
$output = qx{../src/task rc:bug.rc 1 _urgency};
like ($output, qr/ 8\n/, 'blocking urgency == 8');
$output = qx{../src/task rc:bug.rc 2 _urgency};
like ($output, qr/ -5\n/, 'blocked urgency == -5');
qx{../src/task rc:bug.rc 1 done};
qx{../src/task rc:bug.rc list};
$output = qx{../src/task rc:bug.rc 1 _urgency};
like ($output, qr/ 0\n/, 'unblocked urgency == 0');
# Cleanup.
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;