From c71146611cf68570be045c89c00cf61689d87cd4 Mon Sep 17 00:00:00 2001 From: Louis-Claude Canon Date: Tue, 24 Jul 2012 16:55:59 -0400 Subject: [PATCH] Bug #1036 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Remove the test that prevents 'until' attributes to be modified for non-recurring tasks (thanks to Stéphane Pezennec). - Unit test. Signed-off-by: Paul Beckingham --- AUTHORS | 1 + ChangeLog | 2 ++ src/commands/CmdModify.cpp | 5 --- src/en-US.h | 1 - test/bug.1036.t | 63 ++++++++++++++++++++++++++++++++++++++ 5 files changed, 66 insertions(+), 6 deletions(-) create mode 100755 test/bug.1036.t diff --git a/AUTHORS b/AUTHORS index 443fd142d..de0e2c89a 100644 --- a/AUTHORS +++ b/AUTHORS @@ -152,4 +152,5 @@ suggestions: Stanley G Marek Vitek Rene Vergara + Stéphane Pezennec diff --git a/ChangeLog b/ChangeLog index c1392dcb4..389c95375 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,6 +4,8 @@ Bugs + Fixed bug that caused miplaced commas in JSON export (thanks to greenskeleton). + + Fixed bug #1036, which prevents 'until' attributes to be modified for + non-recurring tasks (thanks to Stéphane Pezennec). ------ old releases ------------------------------ diff --git a/src/commands/CmdModify.cpp b/src/commands/CmdModify.cpp index 99fb43f6e..3fc87996e 100644 --- a/src/commands/CmdModify.cpp +++ b/src/commands/CmdModify.cpp @@ -83,11 +83,6 @@ int CmdModify::execute (std::string& output) !before.has ("due")) throw std::string (STRING_CMD_MODIFY_NO_DUE); - if (task->has ("until") && - !task->has ("recur") && - !before.has ("recur")) - throw std::string (STRING_CMD_MODIFY_UNTIL); - if (before.has ("recur") && before.has ("due") && (!task->has ("due") || diff --git a/src/en-US.h b/src/en-US.h index d5a811277..915888e07 100644 --- a/src/en-US.h +++ b/src/en-US.h @@ -448,7 +448,6 @@ #define STRING_CMD_MODIFY_USAGE1 "Modifies the existing task with provided arguments." #define STRING_CMD_MODIFY_NO_DUE "You cannot specify a recurring task without a due date." -#define STRING_CMD_MODIFY_UNTIL "You cannot specify an until date for a non-recurring task." #define STRING_CMD_MODIFY_REM_DUE "You cannot remove the due date from a recurring task." #define STRING_CMD_MODIFY_REC_ALWAYS "You cannot remove the recurrence from a recurring task." #define STRING_CMD_MODIFY_TASK "Modifying task {1} '{2}'." diff --git a/test/bug.1036.t b/test/bug.1036.t new file mode 100755 index 000000000..b60b3d4ec --- /dev/null +++ b/test/bug.1036.t @@ -0,0 +1,63 @@ +#! /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 => 4; + +# 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 #1036: prevents 'until' attributes to be modified for non-recurring +# tasks. + +# Check that until attribute may be modified +qx{../src/task rc:bug.rc add test 2>&1}; +my $output = qx{../src/task rc:bug.rc 1 mod until:1/1/2020 2>&1}; +like ($output, qr/^Modifying task 1 'test'.$/ms, '"until" attribute added'); + +qx{../src/task rc:bug.rc add test until:1/1/2020 2>&1}; +$output = qx{../src/task rc:bug.rc 1 mod /test/Test/ 2>&1}; +like ($output, qr/^Modifying task 1 'Test'.$/ms, 'Task with "until" attribute modified'); + +# 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; +