Commit f358c227 authored by Bram Schoenmakers's avatar Bram Schoenmakers

Adapt negation test cases to work properly with getopt.

When using negation, the "--" separator should be used, so getopt
doesn't stumble over -word constructs.

Also add a test case that checks functionality of a negation with
multiple words.
parent 2d3911cd
...@@ -72,7 +72,7 @@ class ListCommandTest(CommandTest.CommandTest): ...@@ -72,7 +72,7 @@ class ListCommandTest(CommandTest.CommandTest):
self.assertEquals(self.errors, "") self.assertEquals(self.errors, "")
def test_list8(self): def test_list8(self):
command = ListCommand.ListCommand(["-project1"], self.todolist, self.out, self.error) command = ListCommand.ListCommand(["--", "-project1"], self.todolist, self.out, self.error)
command.execute() command.execute()
self.assertFalse(self.todolist.is_dirty()) self.assertFalse(self.todolist.is_dirty())
...@@ -80,7 +80,7 @@ class ListCommandTest(CommandTest.CommandTest): ...@@ -80,7 +80,7 @@ class ListCommandTest(CommandTest.CommandTest):
self.assertEquals(self.errors, "") self.assertEquals(self.errors, "")
def test_list9(self): def test_list9(self):
command = ListCommand.ListCommand(["-project1", "-Drink"], self.todolist, self.out, self.error) command = ListCommand.ListCommand(["--", "-project1", "-Drink"], self.todolist, self.out, self.error)
command.execute() command.execute()
self.assertFalse(self.todolist.is_dirty()) self.assertFalse(self.todolist.is_dirty())
...@@ -120,6 +120,14 @@ class ListCommandTest(CommandTest.CommandTest): ...@@ -120,6 +120,14 @@ class ListCommandTest(CommandTest.CommandTest):
config("") config("")
def test_list13(self):
command = ListCommand.ListCommand(["-x", "--", "-@Context1 +Project2"], self.todolist, self.out, self.error)
command.execute()
self.assertFalse(self.todolist.is_dirty())
self.assertEquals(self.output, " 1 (C) Foo @Context2 Not@Context +Project1 Not+Project\n 3 (C) Baz @Context1 +Project1 key:value id:1\n 4 (C) Drink beer @ home\n 5 (C) 13 + 29 = 42\n")
self.assertEquals(self.errors, "")
def test_help(self): def test_help(self):
command = ListCommand.ListCommand(["help"], self.todolist, self.out, self.error) command = ListCommand.ListCommand(["help"], self.todolist, self.out, self.error)
command.execute() command.execute()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment