From ce64f7e1b70b21e1cb313dabe720302fa903b844 Mon Sep 17 00:00:00 2001 From: "Paul Gauthier (aider)" Date: Sat, 10 Aug 2024 08:53:04 -0700 Subject: [PATCH] feat: Add test for multiple commits in cmd_diff --- tests/basic/test_commands.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/tests/basic/test_commands.py b/tests/basic/test_commands.py index 9aa6d4df5..575ef18c0 100644 --- a/tests/basic/test_commands.py +++ b/tests/basic/test_commands.py @@ -823,6 +823,12 @@ class TestCommands(TestCase): # Run cmd_commit commands.cmd_commit() + # Modify the file again + file_path.write_text("Further 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("") @@ -830,9 +836,8 @@ class TestCommands(TestCase): # Check if the diff output is correct mock_print.assert_called_with(mock.ANY) diff_output = mock_print.call_args[0][0] - self.assertIn("-Initial content", diff_output) - self.assertIn("+Modified content", diff_output) - dump(diff_output) + self.assertIn("-Modified content", diff_output) + self.assertIn("+Further modified content", diff_output) def test_cmd_ask(self): io = InputOutput(pretty=False, yes=True)