mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-20 13:23:08 +02:00
TW-1653: info report regression; shouldn't be context sensitive
- Thanks to David Patrick, Tomas Babej.
This commit is contained in:
parent
995de68c90
commit
ffcc574c85
4 changed files with 83 additions and 5 deletions
|
@ -121,6 +121,8 @@
|
||||||
- TW-1651 Provide opt-out of filter parser's id treatment (thanks to Daniel
|
- TW-1651 Provide opt-out of filter parser's id treatment (thanks to Daniel
|
||||||
Shahaf).
|
Shahaf).
|
||||||
- TW-1652 task rm misparsed (thanks to Daniel Shahaf).
|
- TW-1652 task rm misparsed (thanks to Daniel Shahaf).
|
||||||
|
- TW-1653 info report regression; shouldn't be context sensitive (thanks to
|
||||||
|
David Patrick).
|
||||||
- Prevent potential task duplication during import for non-pending tasks.
|
- Prevent potential task duplication during import for non-pending tasks.
|
||||||
- Show the active context in "context list", if any is active.
|
- Show the active context in "context list", if any is active.
|
||||||
- Fix "task edit" dropping annotation text after newlines.
|
- Fix "task edit" dropping annotation text after newlines.
|
||||||
|
|
|
@ -587,11 +587,11 @@ void CLI2::addContextFilter ()
|
||||||
// Detect if UUID or ID is set, and bail out
|
// Detect if UUID or ID is set, and bail out
|
||||||
for (auto& a : _args)
|
for (auto& a : _args)
|
||||||
{
|
{
|
||||||
if ((a._lextype == Lexer::Type::uuid ||
|
if (a._lextype == Lexer::Type::uuid ||
|
||||||
a._lextype == Lexer::Type::set) &&
|
a._lextype == Lexer::Type::number ||
|
||||||
a.hasTag ("FILTER"))
|
a._lextype == Lexer::Type::set)
|
||||||
{
|
{
|
||||||
context.debug (format ("UUID/ID lexeme found '{1}', not applying context.", a.attribute ("raw")));
|
context.debug (format ("UUID/ID argument found '{1}', not applying context.", a.attribute ("raw")));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,7 +54,7 @@ CmdInfo::CmdInfo ()
|
||||||
// Once the test suite is completely modified, this can be corrected.
|
// Once the test suite is completely modified, this can be corrected.
|
||||||
_displays_id = false;
|
_displays_id = false;
|
||||||
_needs_gc = false;
|
_needs_gc = false;
|
||||||
_uses_context = true;
|
_uses_context = false;
|
||||||
_accepts_filter = true;
|
_accepts_filter = true;
|
||||||
_accepts_modifications = false;
|
_accepts_modifications = false;
|
||||||
_accepts_miscellaneous = false;
|
_accepts_miscellaneous = false;
|
||||||
|
|
|
@ -404,6 +404,82 @@ class ContextEvaluationTest(TestCase):
|
||||||
self.assertIn("work today task", out)
|
self.assertIn("work today task", out)
|
||||||
self.assertNotIn("home today task", out)
|
self.assertNotIn("home today task", out)
|
||||||
|
|
||||||
|
def test_context_not_applied_on_id_filters(self):
|
||||||
|
"""
|
||||||
|
Test that context is not applied when explicit ID
|
||||||
|
filters are used.
|
||||||
|
"""
|
||||||
|
|
||||||
|
self.t('context home')
|
||||||
|
|
||||||
|
# Try task not included in context
|
||||||
|
output = self.t('1 list')[1]
|
||||||
|
|
||||||
|
# Assert that ID filter works even if it does not match the context
|
||||||
|
self.assertIn("work task", output)
|
||||||
|
self.assertNotIn("home task", output)
|
||||||
|
self.assertNotIn("work today task", output)
|
||||||
|
self.assertNotIn("home today task", output)
|
||||||
|
|
||||||
|
# Try task included in context
|
||||||
|
output = self.t('2 list')[1]
|
||||||
|
|
||||||
|
# Assert that ID filter works if it does match
|
||||||
|
# the context (sanity check)
|
||||||
|
self.assertNotIn("work task", output)
|
||||||
|
self.assertIn("home task", output)
|
||||||
|
self.assertNotIn("work today task", output)
|
||||||
|
self.assertNotIn("home today task", output)
|
||||||
|
|
||||||
|
# Test for combination of IDs
|
||||||
|
output = self.t('1 2 list')[1]
|
||||||
|
|
||||||
|
# Assert that ID filter works if it partly matches
|
||||||
|
# and partly does not match the context
|
||||||
|
self.assertIn("work task", output)
|
||||||
|
self.assertIn("home task", output)
|
||||||
|
self.assertNotIn("work today task", output)
|
||||||
|
self.assertNotIn("home today task", output)
|
||||||
|
|
||||||
|
def test_context_not_applied_on_uuid_filters(self):
|
||||||
|
"""
|
||||||
|
Test that context is not applied when explicit UUID
|
||||||
|
filters are used.
|
||||||
|
"""
|
||||||
|
|
||||||
|
self.t('context home')
|
||||||
|
first_uuid = self.t('_get 1.uuid')[1]
|
||||||
|
second_uuid = self.t('_get 2.uuid')[1]
|
||||||
|
|
||||||
|
# Try task not included in context
|
||||||
|
output = self.t('%s list' % first_uuid)[1]
|
||||||
|
|
||||||
|
# Assert that UUID filter works even if it does not match
|
||||||
|
# the context
|
||||||
|
self.assertIn("work task", output)
|
||||||
|
self.assertNotIn("home task", output)
|
||||||
|
self.assertNotIn("work today task", output)
|
||||||
|
self.assertNotIn("home today task", output)
|
||||||
|
|
||||||
|
# Try task included in context
|
||||||
|
output = self.t('%s list' % second_uuid)[1]
|
||||||
|
|
||||||
|
# Assert that UUID filter works if it does match
|
||||||
|
# the context (sanity check)
|
||||||
|
self.assertNotIn("work task", output)
|
||||||
|
self.assertIn("home task", output)
|
||||||
|
self.assertNotIn("work today task", output)
|
||||||
|
self.assertNotIn("home today task", output)
|
||||||
|
|
||||||
|
# Test for combination of UUIDs
|
||||||
|
output = self.t('%s %s list' % (first_uuid, second_uuid))[1]
|
||||||
|
|
||||||
|
# Assert that UUID filter works if it partly matches
|
||||||
|
# and partly does not match the context
|
||||||
|
self.assertIn("work task", output)
|
||||||
|
self.assertIn("home task", output)
|
||||||
|
self.assertNotIn("work today task", output)
|
||||||
|
self.assertNotIn("home today task", output)
|
||||||
|
|
||||||
# TODO Prove context does not interfere with ID-based filters
|
# TODO Prove context does not interfere with ID-based filters
|
||||||
# TODO Prove context does not interfere with UUID-based filters
|
# TODO Prove context does not interfere with UUID-based filters
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue