mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
Better undo output (and remove undo.style
config) (#3672)
This commit is contained in:
parent
dcc8a8cdde
commit
a2f9b92d6c
11 changed files with 105 additions and 331 deletions
|
@ -74,33 +74,13 @@ class TestUndoStyle(TestCase):
|
|||
self.t("add one project:foo priority:H")
|
||||
self.t("1 modify +tag project:bar priority:")
|
||||
|
||||
@unittest.expectedFailure # undo diffs are not supported
|
||||
def test_undo_side_style(self):
|
||||
"""Test that 'rc.undo.style:side' generates the right output"""
|
||||
self.t.config("undo.style", "side")
|
||||
def test_undo_output(self):
|
||||
"""Test that 'task undo' generates the right output"""
|
||||
code, out, err = self.t("undo", input="n\n")
|
||||
self.assertNotRegex(out, "-tags:\\s*\n\\+tags:\\s+tag")
|
||||
self.assertRegex(out, r"tags\s+tag\s*")
|
||||
|
||||
@unittest.expectedFailure # undo diffs are not supported
|
||||
def test_undo_diff_style(self):
|
||||
"""Test that 'rc.undo.style:diff' generates the right output"""
|
||||
self.t.config("undo.style", "diff")
|
||||
code, out, err = self.t("undo", input="n\n")
|
||||
self.assertRegex(out, "-tags:\\s*\n\\+tags:\\s+tag")
|
||||
self.assertNotRegex(out, r"tags\s+tag\s*")
|
||||
|
||||
def test_undo_diff_operations(self):
|
||||
code, out, err = self.t("undo", input="n\n")
|
||||
|
||||
# If the clock ticks a second between `add` and `modify` there is a
|
||||
# fifth operation setting the `modified` property.
|
||||
self.assertRegex(out, "The following [4|5] operations would be reverted:")
|
||||
|
||||
self.assertIn("tag_tag: <empty> -> x", out)
|
||||
self.assertIn("tags: <empty> -> tag", out)
|
||||
self.assertIn("project: foo -> bar", out)
|
||||
self.assertIn("priority: H -> <empty>", out)
|
||||
self.assertRegex(out, r"Delete property 'priority'")
|
||||
self.assertRegex(out, r"Update property 'project'")
|
||||
self.assertRegex(out, r"Add tag 'tag'")
|
||||
|
||||
|
||||
class TestBug634(TestCase):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue