From ecba5fb60da46a4a44022b6af9b2ec667a8b4926 Mon Sep 17 00:00:00 2001 From: "Paul Gauthier (aider)" Date: Sat, 10 Aug 2024 08:55:29 -0700 Subject: [PATCH] feat: add third modification to test case for cmd_diff --- tests/basic/test_commands.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tests/basic/test_commands.py b/tests/basic/test_commands.py index 6a4527dc3..1d74b4bfa 100644 --- a/tests/basic/test_commands.py +++ b/tests/basic/test_commands.py @@ -849,6 +849,22 @@ class TestCommands(TestCase): self.assertIn("-Modified content", diff_output) self.assertIn("+Further modified content", diff_output) + # Modify the file a third time + file_path.write_text("Final modified content") + + # Run cmd_commit again + commands.cmd_commit() + + # Capture the output of cmd_diff + with mock.patch("builtins.print") as mock_print: + commands.cmd_diff("") + + # Check if the diff output is correct + mock_print.assert_called_with(mock.ANY) + diff_output = mock_print.call_args[0][0] + self.assertIn("-Further modified content", diff_output) + self.assertIn("+Final modified content", diff_output) + def test_cmd_ask(self): io = InputOutput(pretty=False, yes=True) coder = Coder.create(self.GPT35, None, io)