From 87158f505af4cd3de07559827cc86e9d6a4fb859 Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Thu, 9 Sep 2010 21:56:16 -0400 Subject: [PATCH] Bug - #489 - tags.none: is not filtering tagless tasks - Context::autoFilter was suppressing 'tags' filter terms due to the +tag/-tag syntax, which we now know only augments attribute modifiers, and doesn't replace them. --- ChangeLog | 1 + src/Context.cpp | 9 +++---- src/tests/bug.489.t | 62 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 66 insertions(+), 6 deletions(-) create mode 100755 src/tests/bug.489.t diff --git a/ChangeLog b/ChangeLog index ea16bc513..7dd3ae879 100644 --- a/ChangeLog +++ b/ChangeLog @@ -72,6 +72,7 @@ after a due date (thanks to T. Charles Yun). + Fixed bug #480, which didn't properly support @ characters in tags. This also now supports $ and #. + + Fixed bug #489, which caused the filter 'tags.none:' to fail. + Fixed problem with command line configuration overrides that had no values. + Fixed problem with the 'undo' command not observing the rc.color or the diff --git a/src/Context.cpp b/src/Context.cpp index 63abd50fa..c4d10c9b8 100644 --- a/src/Context.cpp +++ b/src/Context.cpp @@ -1,7 +1,7 @@ //////////////////////////////////////////////////////////////////////////////// // taskwarrior - a command line task list manager. // -// Copyright 2006 - 2010, Paul Beckingham. +// Copyright 2006 - 2010, Paul Beckingham, Federico Hernandez. // All rights reserved. // // This program is free software; you can redistribute it and/or modify it under @@ -839,11 +839,8 @@ void Context::autoFilter (Att& a, Filter& f) { } - // The mechanism for filtering on tags is +/-. - // Do not handle here - see below. - else if (a.name () == "tags") - { - } + // Note: Tags are handled via the +/- syntax, but also via attribute + // modifiers. // Generic attribute matching. else diff --git a/src/tests/bug.489.t b/src/tests/bug.489.t new file mode 100755 index 000000000..7ba3ff74f --- /dev/null +++ b/src/tests/bug.489.t @@ -0,0 +1,62 @@ +#! /usr/bin/perl +################################################################################ +## taskwarrior - a command line task list manager. +## +## Copyright 2006 - 2010, Paul Beckingham, Federico Hernandez. +## 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"; + + close $fh; + ok (-r 'bug.rc', 'Created bug.rc'); +} + +# Bug #489 - tags.none: is not filtering tagless tasks +qx{../task rc:bug.rc add with +tag}; +qx{../task rc:bug.rc add without}; +my $output = qx{../task rc:bug.rc list tags.none:}; +unlike ($output, qr/with /, 'tags.none: skips tagged'); +like ($output, qr/without/, 'tags.none: finds tagless'); + +# 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;