diff --git a/src/Variant.cpp b/src/Variant.cpp index f343d7642..ee848a05d 100644 --- a/src/Variant.cpp +++ b/src/Variant.cpp @@ -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_string: { - // Why the "if" instead of "min"? This is an attempt to eliminate one - // std::string::substr call. int left_length = left._string.length (); if (left_length == 0) return false; @@ -772,9 +770,9 @@ bool Variant::operator_partial (const Variant& other) const return false; if (left_length < right_length) - return left._string == right._string.substr (0, left_length); - else - return left._string.substr (0, right_length) == right._string; + return false; + + return left._string.substr (0, right_length) == right._string; } // TODO Implement same-day comparison. case type_date: left.cast (type_date); return left._date == right._date; diff --git a/test/bug.656.t b/test/bug.656.t index c8f13b562..e5f456c9a 100755 --- a/test/bug.656.t +++ b/test/bug.656.t @@ -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 # Second recurring task is created. - qx{../src/task rc:bug.rc ls 2>&1}; - # Result: Check for an extra task the second time task ls is executed my $output = qx{../src/task rc:bug.rc ls 2>&1}; like ($output, qr/^2 tasks$/ms, '2 tasks shown.'); diff --git a/test/subproject.t b/test/subproject.t index 54b70f7e0..ab7fad0ab 100755 --- a/test/subproject.t +++ b/test/subproject.t @@ -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'); $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. unlink qw(pending.data completed.data undo.data backlog.data sp.rc);