- Fixed bug #818, which caused partial tag matching (thanks to Joe Holloway).
- Note that the regex word boundary anchors are different for Solaris
  and Linux, and largely broken on OSX.
- Added unit tests.
This commit is contained in:
Paul Beckingham 2012-02-12 10:42:24 -05:00
parent efb2476c15
commit 28a4947234
5 changed files with 97 additions and 9 deletions

View file

@ -120,4 +120,5 @@ suggestions:
Eli Lev
Paul-Gheorghe Barbu
Jennifer Cormier
Joe Holloway

View file

@ -208,6 +208,7 @@
+ Fixed bug #817, which caused a build problem with a Core2 Duo processor on a
Mac OSX 10.6 machine. Notes updated in INSTALL file (thanks to John
Hammond).
+ Fixed bug #818, which caused partial tag matching (thanks to Joe Holloway).
+ Fixed bug #822, #845, which generated incorrect IDs (thanks to Matt Kraai and
Michelle Crane).
+ Fixed bug #823, so that recurring task change propagations are now always

View file

@ -1,9 +0,0 @@
Beta1 Punch List
- DOM access
- task.1 man page that is accurate
- taskrc.5 man page that is accurate
Release Punch List
- All updated man pages
- All important bug fixes

View file

@ -1017,10 +1017,14 @@ const A3 A3::expand (const A3& input) const
{
expanded.push_back (Arg (name, Arg::type_string, Arg::cat_dom));
expanded.push_back (Arg ("~", Arg::cat_op));
#ifdef DARWIN
expanded.push_back (Arg (value, Arg::type_string, Arg::cat_literal));
#else
#ifdef SOLARIS
expanded.push_back (Arg ("\\<" + value + "\\>", Arg::type_string, Arg::cat_rx));
#else
expanded.push_back (Arg ("\\b" + value + "\\b", Arg::type_string, Arg::cat_rx));
#endif
#endif
}
@ -1029,10 +1033,14 @@ const A3 A3::expand (const A3& input) const
{
expanded.push_back (Arg (name, Arg::type_string, Arg::cat_dom));
expanded.push_back (Arg ("!~", Arg::cat_op));
#ifdef DARWIN
expanded.push_back (Arg (value, Arg::type_string, Arg::cat_literal));
#else
#ifdef SOLARIS
expanded.push_back (Arg ("\\<" + value + "\\>", Arg::type_string, Arg::cat_rx));
#else
expanded.push_back (Arg ("\\b" + value + "\\b", Arg::type_string, Arg::cat_rx));
#endif
#endif
}
else
@ -1048,7 +1056,15 @@ const A3 A3::expand (const A3& input) const
expanded.push_back (Arg ("tags", Arg::type_string, Arg::cat_dom));
expanded.push_back (Arg (type == '+' ? "~" : "!~", Arg::cat_op));
#ifdef DARWIN
expanded.push_back (Arg (value, Arg::type_string, Arg::cat_literal));
#else
#ifdef SOLARIS
expanded.push_back (Arg ("\\<" + value + "\\>", Arg::type_string, Arg::cat_rx));
#else
expanded.push_back (Arg ("\\b" + value + "\\b", Arg::type_string, Arg::cat_rx));
#endif
#endif
}
// word --> description ~ word

79
test/bug.818.t Executable file
View file

@ -0,0 +1,79 @@
#! /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 => 10;
# 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 #818: Filtering by tag counter-intuitively uses partial match
qx{../src/task rc:bug.rc add +hannah +anna Buy some bananas};
my $output = qx{../src/task rc:bug.rc list +hannah};
like ($output, qr/bananas/, 'Containing tag query');
$output = qx{../src/task rc:bug.rc list +anna};
like ($output, qr/bananas/, 'Contained tag query');
qx{../src/task rc:bug.rc add +anna +hannah Buy tickets to Santana};
$output = qx{../src/task rc:bug.rc list +anna};
like ($output, qr/Santana/, 'Contained tag query');
$output = qx{../src/task rc:bug.rc list +hannah};
like ($output, qr/Santana/, 'Containing tag query');
# Buy some bananas +hannah +anna
# Buy tickets to Santana +anna +hannah
# AAA +hannah
# BBB +anna
qx{../src/task rc:bug.rc add +hannah AAA};
qx{../src/task rc:bug.rc add +anna BBB};
$output = qx{../src/task rc:bug.rc long +anna};
like ($output, qr/bananas/, '+anna --> bananas');
like ($output, qr/Santana/, '+anna --> Santana');
unlike ($output, qr/AAA/, '+anna !-> AAA');
like ($output, qr/BBB/, '+anna --> BBB');
# 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;