mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
Bug Fix - #360 Huh? "You cannot remove the recurrence from a recurring task. "
- The logic for detecting changes to a recurring task was wrong. - Added unit tests for this bug.
This commit is contained in:
parent
545013e839
commit
383962173e
3 changed files with 78 additions and 5 deletions
|
@ -63,6 +63,8 @@
|
|||
+ Fixed bug that was causing the 'completed' report to sort incorrectly.
|
||||
+ Fixed bug that showed a calendar for the year 2037 when 'task calendar due'
|
||||
was run, and there are no tasks with due dates.
|
||||
+ Fixed bug #360 which prevented certain modifications to recurring tasks
|
||||
(thanks to John Flrorian).
|
||||
|
||||
------ old releases ------------------------------
|
||||
|
||||
|
|
|
@ -1134,12 +1134,13 @@ int handleModify (std::string &outs)
|
|||
throw std::string ("You cannot specify an until date for a non-recurring task.");
|
||||
|
||||
if (task->has ("due") &&
|
||||
!context.task.has ("due") &&
|
||||
context.task.has ("recur"))
|
||||
context.task.has ("due") &&
|
||||
context.task.get ("due") == "")
|
||||
throw std::string ("You cannot remove the due date from a recurring task.");
|
||||
|
||||
if (task->has ("recur") &&
|
||||
!context.task.has ("recur"))
|
||||
context.task.has ("recur") &&
|
||||
context.task.get ("recur") == "")
|
||||
throw std::string ("You cannot remove the recurrence from a recurring task.");
|
||||
|
||||
// Make all changes.
|
||||
|
|
70
src/tests/bug.360.t
Executable file
70
src/tests/bug.360.t
Executable file
|
@ -0,0 +1,70 @@
|
|||
#! /usr/bin/perl
|
||||
################################################################################
|
||||
## task - a command line task list manager.
|
||||
##
|
||||
## Copyright 2006 - 2010, Paul Beckingham.
|
||||
## All rights reserved.
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or modify it under
|
||||
## the terms of the GNU General Public License as published by the Free Software
|
||||
## Foundation; either version 2 of the License, or (at your option) any later
|
||||
## version.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
## FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
## details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License along with
|
||||
## this program; if not, write to the
|
||||
##
|
||||
## Free Software Foundation, Inc.,
|
||||
## 51 Franklin Street, Fifth Floor,
|
||||
## Boston, MA
|
||||
## 02110-1301
|
||||
## USA
|
||||
##
|
||||
################################################################################
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 7;
|
||||
|
||||
# Create the rc file.
|
||||
if (open my $fh, '>', 'bug.rc')
|
||||
{
|
||||
print $fh "data.location=.\n",
|
||||
"confirmation=no\n";
|
||||
close $fh;
|
||||
ok (-r 'bug.rc', 'Created bug.rc');
|
||||
}
|
||||
|
||||
# Setup: Add a recurring task, generate an instance, then add a project.
|
||||
qx{../task rc:bug.rc add foo due:tomorrow recur:daily};
|
||||
qx{../task rc:bug.rc ls};
|
||||
|
||||
# Result: trying to add the project generates an error about removing
|
||||
# recurrence from a task.
|
||||
my $output = qx{../task rc:bug.rc 2 project:bar};
|
||||
unlike ($output, qr/You cannot remove the recurrence from a recurring task./ms, 'No recurrence removal error');
|
||||
|
||||
# Now try to generate the error above via regular means - ie, is it actually
|
||||
# doing what it should?
|
||||
$output = qx{../task rc:bug.rc 2 recur:};
|
||||
like ($output, qr/You cannot remove the recurrence from a recurring task./ms, 'Recurrence removal error');
|
||||
|
||||
# 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');
|
||||
|
||||
exit 0;
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue