From 5325efbd074d7d46ed72ae8ec9a27bd6c9a52c3d Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Mon, 21 Sep 2015 07:28:26 -0400 Subject: [PATCH] TW-1700: modify tags behavior changed - Thanks to David Badura. --- AUTHORS | 1 + ChangeLog | 1 + src/Task.cpp | 3 +++ test/tag.t | 17 +++++++++++++++++ 4 files changed, 22 insertions(+) diff --git a/AUTHORS b/AUTHORS index ec76322c7..7b2b5e5d9 100644 --- a/AUTHORS +++ b/AUTHORS @@ -275,3 +275,4 @@ suggestions: Marc Cornellà Ander Naga Kiran + David Badura diff --git a/ChangeLog b/ChangeLog index 234d34597..78488d11e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -159,6 +159,7 @@ - TW-1692 '42//' segfaults (thanks to Daniel Shahaf). - TW-1695 edit: Concurrent edits (thanks to Daniel Shahaf). - 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). - Prevent potential task duplication during import for non-pending tasks. - Show the active context in "context list", if any is active. diff --git a/src/Task.cpp b/src/Task.cpp index 7279acb56..20c21a80e 100644 --- a/src/Task.cpp +++ b/src/Task.cpp @@ -2060,6 +2060,9 @@ void Task::modify (modType type, bool text_required /* = false */) // For those using the "tags:..." attribute directly. else if (name == "tags") { + // TW-1701 + set ("tags", ""); + std::vector tags; split (tags, value, ','); diff --git a/test/tag.t b/test/tag.t index ae50f2eab..9513c7577 100755 --- a/test/tag.t +++ b/test/tag.t @@ -488,6 +488,23 @@ class TestListAllTags(TestCase): 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__": from simpletap import TAPTestRunner unittest.main(testRunner=TAPTestRunner())