mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-21 12:55:00 +00:00
Add a test to trigger the UnboundLocalError bug in the cmd_run method
Commit message: Add test to trigger UnboundLocalError in cmd_run method
This commit is contained in:
parent
b69bf02115
commit
c8e5c27a2f
1 changed files with 15 additions and 0 deletions
|
@ -536,6 +536,21 @@ class TestCommands(TestCase):
|
|||
commands.cmd_add("file.txt")
|
||||
self.assertEqual(coder.abs_fnames, set())
|
||||
|
||||
def test_cmd_run_unbound_local_error(self):
|
||||
with ChdirTemporaryDirectory():
|
||||
io = InputOutput(pretty=False, yes=False)
|
||||
from aider.coders import Coder
|
||||
|
||||
coder = Coder.create(self.GPT35, None, io)
|
||||
commands = Commands(io, coder)
|
||||
|
||||
# Mock the io.prompt_ask method to simulate user input
|
||||
io.prompt_ask = lambda *args, **kwargs: "custom instructions"
|
||||
|
||||
# Test the cmd_run method with a command that should trigger the bug
|
||||
with self.assertRaises(UnboundLocalError):
|
||||
commands.cmd_run("echo test", add_on_nonzero_exit=False)
|
||||
|
||||
def test_cmd_add_drop_untracked_files(self):
|
||||
with GitTemporaryDirectory():
|
||||
repo = git.Repo()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue