mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
Bug Fix - #260
- Fixed bug whereby the start, stop and delete commands were not complaining when filter arguments were specified, even though they were ignored. Thanks to Charles T. Yun.
This commit is contained in:
parent
1b28d8714b
commit
ec7f7cc939
5 changed files with 86 additions and 0 deletions
|
@ -24,6 +24,9 @@
|
|||
automatic creation of an alternate rc file (thanks to Zach Frazier).
|
||||
+ Fixed bug #250 whereby rc.dateformat was not observed when parsing the
|
||||
creation date of an annotation (thanks to Federico Hernandez).
|
||||
+ Fixed bug #260 whereby the start, stop and delete commands did not complain
|
||||
when filter arguments were specified, even though they were ignored
|
||||
(thanks to Charles T. Yun).
|
||||
|
||||
------ old releases ------------------------------
|
||||
|
||||
|
|
|
@ -316,6 +316,18 @@ std::string Context::canonicalize (const std::string& input) const
|
|||
return canonical;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
void Context::disallowModification () const
|
||||
{
|
||||
if (task.size () ||
|
||||
subst.mFrom != "" ||
|
||||
tagAdditions.size () ||
|
||||
tagRemovals.size ())
|
||||
throw std::string ("The '")
|
||||
+ cmd.command
|
||||
+ "' command does not allow further modification of a task.";
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
void Context::loadCorrectConfigFile ()
|
||||
{
|
||||
|
|
|
@ -65,6 +65,7 @@ public:
|
|||
void clear ();
|
||||
|
||||
std::string canonicalize (const std::string&) const;
|
||||
void disallowModification () const;
|
||||
|
||||
private:
|
||||
void loadCorrectConfigFile ();
|
||||
|
|
|
@ -387,6 +387,8 @@ std::string handleCompletionIDs ()
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
void handleUndo ()
|
||||
{
|
||||
context.disallowModification ();
|
||||
|
||||
context.tdb.lock (context.config.get ("locking", true));
|
||||
context.tdb.undo ();
|
||||
context.tdb.unlock ();
|
||||
|
@ -557,6 +559,8 @@ std::string handleDelete ()
|
|||
{
|
||||
std::stringstream out;
|
||||
|
||||
context.disallowModification ();
|
||||
|
||||
std::vector <Task> tasks;
|
||||
context.tdb.lock (context.config.get ("locking", true));
|
||||
Filter filter;
|
||||
|
@ -656,6 +660,8 @@ std::string handleStart ()
|
|||
{
|
||||
std::stringstream out;
|
||||
|
||||
context.disallowModification ();
|
||||
|
||||
std::vector <Task> tasks;
|
||||
context.tdb.lock (context.config.get ("locking", true));
|
||||
Filter filter;
|
||||
|
@ -707,6 +713,8 @@ std::string handleStop ()
|
|||
{
|
||||
std::stringstream out;
|
||||
|
||||
context.disallowModification ();
|
||||
|
||||
std::vector <Task> tasks;
|
||||
context.tdb.lock (context.config.get ("locking", true));
|
||||
Filter filter;
|
||||
|
|
62
src/tests/bug.start.extra.t
Executable file
62
src/tests/bug.start.extra.t
Executable file
|
@ -0,0 +1,62 @@
|
|||
#! /usr/bin/perl
|
||||
################################################################################
|
||||
## task - a command line task list manager.
|
||||
##
|
||||
## Copyright 2006 - 2009, 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, '>', 'extra.rc')
|
||||
{
|
||||
print $fh "data.location=.\n",
|
||||
"confirmation=no\n";
|
||||
close $fh;
|
||||
ok (-r 'extra.rc', 'Created extra.rc');
|
||||
}
|
||||
|
||||
qx{../task rc:extra.rc add foo};
|
||||
my $output = qx{../task rc:extra.rc 1 start pri:L};
|
||||
like ($output, qr/The 'start' command does not allow further modification of a task\./, 'no modifications allowed for start');
|
||||
$output = qx{../task rc:extra.rc 1 stop pro:bar};
|
||||
like ($output, qr/The 'stop' command does not allow further modification of a task\./, 'no modifications allowed for stop');
|
||||
|
||||
# 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 'extra.rc';
|
||||
ok (!-r 'extra.rc', 'Removed extra.rc');
|
||||
|
||||
exit 0;
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue