TW-1700: modify tags behavior changed

- Thanks to David Badura.
This commit is contained in:
Paul Beckingham 2015-09-21 07:28:26 -04:00
parent 6c90875da4
commit 5325efbd07
4 changed files with 22 additions and 0 deletions

View file

@ -275,3 +275,4 @@ suggestions:
Marc Cornellà Marc Cornellà
Ander Ander
Naga Kiran Naga Kiran
David Badura

View file

@ -159,6 +159,7 @@
- TW-1692 '42//' segfaults (thanks to Daniel Shahaf). - TW-1692 '42//' segfaults (thanks to Daniel Shahaf).
- TW-1695 edit: Concurrent edits (thanks to Daniel Shahaf). - TW-1695 edit: Concurrent edits (thanks to Daniel Shahaf).
- TW-1699 Command interpretation displayed incorrectly (thanks to Tomas Babej). - TW-1699 Command interpretation displayed incorrectly (thanks to Tomas Babej).
- TW-1700 modify tags behavior changed (thanks to David Badura).
- TW-1701 Some generated UUIDs deemed invalid (thanks to Wim Schuermann). - TW-1701 Some generated UUIDs deemed invalid (thanks to Wim Schuermann).
- 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.

View file

@ -2060,6 +2060,9 @@ void Task::modify (modType type, bool text_required /* = false */)
// For those using the "tags:..." attribute directly. // For those using the "tags:..." attribute directly.
else if (name == "tags") else if (name == "tags")
{ {
// TW-1701
set ("tags", "");
std::vector <std::string> tags; std::vector <std::string> tags;
split (tags, value, ','); split (tags, value, ',');

View file

@ -488,6 +488,23 @@ class TestListAllTags(TestCase):
self.assertIn("t2", out) self.assertIn("t2", out)
class TestBug1700(TestCase):
def setUp(self):
self.t = Task()
def test_tags_overwrite(self):
"""Verify that 'tags:a,b' overwrites existing tags."""
self.t("add +tag1 +tag2 one")
code, out, err = self.t("_get 1.tags")
self.assertIn("tag1,tag2", out)
self.assertNotIn("tag3", out)
self.t("1 modify tags:tag2,tag3")
code, out, err = self.t("_get 1.tags")
self.assertNotIn("tag1", out)
self.assertIn("tag2,tag3", out)
if __name__ == "__main__": if __name__ == "__main__":
from simpletap import TAPTestRunner from simpletap import TAPTestRunner
unittest.main(testRunner=TAPTestRunner()) unittest.main(testRunner=TAPTestRunner())