From 70d5f595c77387ce26aeb125eb3a0a0fe41229dc Mon Sep 17 00:00:00 2001 From: Wilhelm Schuermann Date: Thu, 2 Apr 2015 12:45:39 +0200 Subject: [PATCH] TW-1584: attr.{isnt,not} use partial matching - Change attr.{isnt,not} to be the exact opposite of attr{:is,:}, i.e. exact matching. - Fix tests that assumed the old behavior was intended. --- ChangeLog | 1 + src/CLI.cpp | 2 +- test/bug.906.t | 2 +- test/filter-prefix.t | 18 +++--------------- 4 files changed, 6 insertions(+), 17 deletions(-) diff --git a/ChangeLog b/ChangeLog index e6845af35..d95b5e280 100644 --- a/ChangeLog +++ b/ChangeLog @@ -9,6 +9,7 @@ to Ulf Eliasson). - TW-1583 Invalid ID displayed for first report after done/delete (thanks to Ulf Eliasson). +- TW-1584 attr.{isnt,not} use partial matching. - TW-1587 Fix and improve example on-exit hook, adjust to new hooks API (thanks to Jochen Sprickerhof). - TW-1588 Most Export scripts cannot deal with new export format (thanks to diff --git a/src/CLI.cpp b/src/CLI.cpp index c355a77ee..506850f60 100644 --- a/src/CLI.cpp +++ b/src/CLI.cpp @@ -1234,7 +1234,7 @@ void CLI::desugarFilterAttributeModifiers () } else if (modifier == "isnt" || modifier == "not") { - op.attribute ("raw", "!="); + op.attribute ("raw", "!=="); rhs.attribute ("raw", "'" + value + "'"); rhs.tag ("LITERAL"); } diff --git a/test/bug.906.t b/test/bug.906.t index f0d6488a9..ed3e1ac55 100755 --- a/test/bug.906.t +++ b/test/bug.906.t @@ -66,7 +66,7 @@ unlike ($output, qr/two/, "$ut: list - two included"); $output = qx{../src/task rc:$rc list pro.not:a 2>&1}; like ($output, qr/zero/, "$ut: list - zero included"); -unlike ($output, qr/one/, "$ut: list - one excluded"); +like ($output, qr/one/, "$ut: list - one included"); unlike ($output, qr/two/, "$ut: list - two excluded"); $output = qx{../src/task rc:$rc list pro.not:a.b 2>&1}; diff --git a/test/filter-prefix.t b/test/filter-prefix.t index c55061725..94db6bf19 100755 --- a/test/filter-prefix.t +++ b/test/filter-prefix.t @@ -79,9 +79,9 @@ class TestFilterPrefix(TestCase): def test_list_project_not_foo(self): """Filter on not project name.""" code, out, err = self.t(('list', 'project.not:foo')) - self.assertNotIn('one', out) - self.assertNotIn('two', out) - self.assertNotIn('three', out) + self.assertIn('one', out) + self.assertIn('two', out) + self.assertIn('three', out) self.assertIn('four', out) self.assertIn('five', out) self.assertIn('six', out) @@ -112,18 +112,6 @@ class TestFilterPrefix(TestCase): self.assertIn('seven', out) self.assertIn('eight', out) - def test_list_project_not_ba(self): - """Filter on project partial non-match.""" - code, out, err = self.t(('list', 'project.not:ba')) - self.assertIn('one', out) - self.assertIn('two', out) - self.assertIn('three', out) - self.assertNotIn('four', out) - self.assertNotIn('five', out) - self.assertNotIn('six', out) - self.assertNotIn('seven', out) - self.assertNotIn('eight', out) - def test_list_description_has_foo(self): """Filter on description pattern.""" code, out, err = self.t(('list', 'description.has:foo'))