From 9352bc67ca9903edbcea00bf3de6e36a5c512e12 Mon Sep 17 00:00:00 2001 From: Paul Gauthier Date: Sun, 23 Jul 2023 08:30:11 -0300 Subject: [PATCH] Added test case for issue #139 --- tests/test_commands.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/tests/test_commands.py b/tests/test_commands.py index 26d2a14e5..bca022a24 100644 --- a/tests/test_commands.py +++ b/tests/test_commands.py @@ -84,7 +84,7 @@ class TestCommands(TestCase): def test_cmd_add_drop_directory(self): # Initialize the Commands and InputOutput objects - io = InputOutput(pretty=False, yes=True) + io = InputOutput(pretty=False, yes=False) from aider.coders import Coder coder = Coder.create(models.GPT35, None, io) @@ -112,6 +112,21 @@ class TestCommands(TestCase): str(Path("test_dir/another_dir/test_file.txt").resolve()), coder.abs_fnames ) + # Issue #139 /add problems when cwd != git_root + + # remember the proper abs path to this file + abs_fname = str(Path("test_dir/another_dir/test_file.txt").resolve()) + + # chdir to someplace other than git_root + Path("side_dir").mkdir() + os.chdir("side_dir") + + # add it via it's git_root referenced name + commands.cmd_add("test_dir/another_dir/test_file.txt") + + # it should be there, but was not in v0.10.0 + self.assertIn(abs_fname, coder.abs_fnames) + def test_cmd_drop_with_glob_patterns(self): # Initialize the Commands and InputOutput objects io = InputOutput(pretty=False, yes=True)