mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
Bug #995
- Fixed bug #995, which mis-parsed UUIDs in filters as other elements (thanks to Bryce Harrington). - Nibbler no longer permits 8-character UUID abbreviations, because too often they resemble other forms, such as '1111111d' which looks like a duration. - Modified unit tests accordingly.
This commit is contained in:
parent
10aa70a53b
commit
f4bfa1b2fd
6 changed files with 22 additions and 28 deletions
|
@ -28,6 +28,8 @@ Bugs
|
||||||
clearly stated (thanks to Louis-Claude Canon).
|
clearly stated (thanks to Louis-Claude Canon).
|
||||||
+ Applied patch for bug #991, which removes an obsolete consistency check
|
+ Applied patch for bug #991, which removes an obsolete consistency check
|
||||||
(thanks to Louis-Claude Canon).
|
(thanks to Louis-Claude Canon).
|
||||||
|
+ Fixed bug #995, which mis-parsed UUIDs in filters as other elements (thanks
|
||||||
|
to Bryce Harrington).
|
||||||
+ Fixed bug #997, so that output is correctly conrolled by the 'affected'
|
+ Fixed bug #997, so that output is correctly conrolled by the 'affected'
|
||||||
verbosity token.
|
verbosity token.
|
||||||
+ Fixed grammar in feedback string (thanks to Uli Martens).
|
+ Fixed grammar in feedback string (thanks to Uli Martens).
|
||||||
|
|
26
src/A3.cpp
26
src/A3.cpp
|
@ -739,6 +739,19 @@ const A3 A3::tokenize (const A3& input) const
|
||||||
found_something_after_sequence = true;
|
found_something_after_sequence = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
else if (is_uuid (n, s))
|
||||||
|
{
|
||||||
|
if (found_something_after_sequence)
|
||||||
|
{
|
||||||
|
output.push_back (Arg (s, Arg::type_string, Arg::cat_literal));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
output.push_back (Arg (s, Arg::type_string, Arg::cat_uuid));
|
||||||
|
found_sequence = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Must be higher than number.
|
// Must be higher than number.
|
||||||
// Must be higher than operator.
|
// Must be higher than operator.
|
||||||
// Note that Nibbler::getDate does not read durations.
|
// Note that Nibbler::getDate does not read durations.
|
||||||
|
@ -809,19 +822,6 @@ const A3 A3::tokenize (const A3& input) const
|
||||||
found_something_after_sequence = true;
|
found_something_after_sequence = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (is_uuid (n, s))
|
|
||||||
{
|
|
||||||
if (found_something_after_sequence)
|
|
||||||
{
|
|
||||||
output.push_back (Arg (s, Arg::type_string, Arg::cat_literal));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
output.push_back (Arg (s, Arg::type_string, Arg::cat_uuid));
|
|
||||||
found_sequence = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
else if (is_id (n, s))
|
else if (is_id (n, s))
|
||||||
{
|
{
|
||||||
if (found_something_after_sequence)
|
if (found_something_after_sequence)
|
||||||
|
|
|
@ -39,7 +39,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static const char* _uuid_pattern = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx";
|
static const char* _uuid_pattern = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx";
|
||||||
static const unsigned int _uuid_min_length = 8;
|
static const unsigned int _uuid_min_length = 9;
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
Nibbler::Nibbler ()
|
Nibbler::Nibbler ()
|
||||||
|
|
|
@ -44,7 +44,6 @@ if (open my $fh, '>', 'bug.rc')
|
||||||
# - deleting task with UUID 874e146d-07a2-2d2c-7808-a76e74b1a332
|
# - deleting task with UUID 874e146d-07a2-2d2c-7808-a76e74b1a332
|
||||||
# - searching for tasks "foo" and "bar"
|
# - searching for tasks "foo" and "bar"
|
||||||
|
|
||||||
|
|
||||||
qx{../src/task rc:bug.rc add foo};
|
qx{../src/task rc:bug.rc add foo};
|
||||||
qx{../src/task rc:bug.rc add bar};
|
qx{../src/task rc:bug.rc add bar};
|
||||||
my $output = qx{../src/task rc:bug.rc list};
|
my $output = qx{../src/task rc:bug.rc list};
|
||||||
|
@ -56,8 +55,6 @@ $output = qx{../src/task rc:bug.rc list};
|
||||||
like ($output, qr/foo/ms, 'Task foo not deleted');
|
like ($output, qr/foo/ms, 'Task foo not deleted');
|
||||||
like ($output, qr/bar/ms, 'Task bar not deleted');
|
like ($output, qr/bar/ms, 'Task bar not deleted');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Cleanup.
|
# Cleanup.
|
||||||
unlink qw(pending.data completed.data undo.data backlog.data synch.key bug.rc);
|
unlink qw(pending.data completed.data undo.data backlog.data synch.key bug.rc);
|
||||||
ok (! -r 'pending.data' &&
|
ok (! -r 'pending.data' &&
|
||||||
|
|
|
@ -157,7 +157,7 @@ like ($output, qr/one/, "Found with $short");
|
||||||
|
|
||||||
($short) = $uuid =~ /^(.{8})/;
|
($short) = $uuid =~ /^(.{8})/;
|
||||||
$output = qx{../src/task rc:bug.rc $short list};
|
$output = qx{../src/task rc:bug.rc $short list};
|
||||||
like ($output, qr/one/, "Found with $short");
|
unlike ($output, qr/one/, "Not found with $short");
|
||||||
|
|
||||||
($short) = $uuid =~ /^(.{7})/;
|
($short) = $uuid =~ /^(.{7})/;
|
||||||
$output = qx{../src/task rc:bug.rc $short list};
|
$output = qx{../src/task rc:bug.rc $short list};
|
||||||
|
|
|
@ -39,15 +39,15 @@ int main (int argc, char** argv)
|
||||||
{
|
{
|
||||||
#ifdef NIBBLER_FEATURE_DATE
|
#ifdef NIBBLER_FEATURE_DATE
|
||||||
#ifdef NIBBLER_FEATURE_REGEX
|
#ifdef NIBBLER_FEATURE_REGEX
|
||||||
UnitTest t (388);
|
UnitTest t (385);
|
||||||
#else
|
#else
|
||||||
UnitTest t (364);
|
UnitTest t (361);
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
#ifdef NIBBLER_FEATURE_REGEX
|
#ifdef NIBBLER_FEATURE_REGEX
|
||||||
UnitTest t (338);
|
UnitTest t (335);
|
||||||
#else
|
#else
|
||||||
UnitTest t (314);
|
UnitTest t (311);
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -490,12 +490,7 @@ int main (int argc, char** argv)
|
||||||
t.ok (n.depleted (), "depleted");
|
t.ok (n.depleted (), "depleted");
|
||||||
|
|
||||||
n = Nibbler ("a0b1c2d3");
|
n = Nibbler ("a0b1c2d3");
|
||||||
t.ok (n.getPartialUUID (s), "partial uuid [8] found");
|
t.notok (n.getPartialUUID (s), "partial uuid [8] not found");
|
||||||
t.is (s, "a0b1c2d3", "partial uuid [8] -> correct");
|
|
||||||
t.ok (n.depleted (), "depleted");
|
|
||||||
|
|
||||||
n = Nibbler ("a0b1c2d");
|
|
||||||
t.notok (n.getPartialUUID (s), "partial uuid [7] not found");
|
|
||||||
t.notok (n.depleted (), "not depleted");
|
t.notok (n.depleted (), "not depleted");
|
||||||
|
|
||||||
// bool getDateISO (time_t&);
|
// bool getDateISO (time_t&);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue