mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-29 07:57:20 +02:00
Variant
- The partial match operator now expects length(left) > length(right).
This commit is contained in:
parent
ef412d0588
commit
7f56187748
3 changed files with 4 additions and 8 deletions
|
@ -761,8 +761,6 @@ bool Variant::operator_partial (const Variant& other) const
|
||||||
case type_real: right.cast (type_string); return left._string == right._string;
|
case type_real: right.cast (type_string); return left._string == right._string;
|
||||||
case type_string:
|
case type_string:
|
||||||
{
|
{
|
||||||
// Why the "if" instead of "min"? This is an attempt to eliminate one
|
|
||||||
// std::string::substr call.
|
|
||||||
int left_length = left._string.length ();
|
int left_length = left._string.length ();
|
||||||
if (left_length == 0)
|
if (left_length == 0)
|
||||||
return false;
|
return false;
|
||||||
|
@ -772,8 +770,8 @@ bool Variant::operator_partial (const Variant& other) const
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (left_length < right_length)
|
if (left_length < right_length)
|
||||||
return left._string == right._string.substr (0, left_length);
|
return false;
|
||||||
else
|
|
||||||
return left._string.substr (0, right_length) == right._string;
|
return left._string.substr (0, right_length) == right._string;
|
||||||
}
|
}
|
||||||
// TODO Implement same-day comparison.
|
// TODO Implement same-day comparison.
|
||||||
|
|
|
@ -50,10 +50,8 @@ qx{../src/task rc:bug.rc add Second recurring task due:tomorrow rec:daily 2>&1};
|
||||||
|
|
||||||
# Bug describes that each time task is executed, another child task of the
|
# Bug describes that each time task is executed, another child task of the
|
||||||
# Second recurring task is created.
|
# Second recurring task is created.
|
||||||
|
|
||||||
qx{../src/task rc:bug.rc ls 2>&1};
|
qx{../src/task rc:bug.rc ls 2>&1};
|
||||||
|
|
||||||
|
|
||||||
# Result: Check for an extra task the second time task ls is executed
|
# Result: Check for an extra task the second time task ls is executed
|
||||||
my $output = qx{../src/task rc:bug.rc ls 2>&1};
|
my $output = qx{../src/task rc:bug.rc ls 2>&1};
|
||||||
like ($output, qr/^2 tasks$/ms, '2 tasks shown.');
|
like ($output, qr/^2 tasks$/ms, '2 tasks shown.');
|
||||||
|
|
|
@ -63,7 +63,7 @@ $output = qx{../src/task rc:sp.rc list project:abc 2>&1};
|
||||||
like ($output, qr/\babc\s/m, 'abc,ab,a,b | a -> abc');
|
like ($output, qr/\babc\s/m, 'abc,ab,a,b | a -> abc');
|
||||||
|
|
||||||
$output = qx{../src/task rc:sp.rc list project:abcd 2>&1 >/dev/null};
|
$output = qx{../src/task rc:sp.rc list project:abcd 2>&1 >/dev/null};
|
||||||
like ($output, qr/No matches./, 'abc,ab,a,b | abcd -> nul');
|
like ($output, qr/No matches\./, 'abc,ab,a,b | abcd -> nul');
|
||||||
|
|
||||||
# Cleanup.
|
# Cleanup.
|
||||||
unlink qw(pending.data completed.data undo.data backlog.data sp.rc);
|
unlink qw(pending.data completed.data undo.data backlog.data sp.rc);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue