mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-28 16:25:00 +00:00
Fixed /commit after repo refactor, added test coverage
This commit is contained in:
parent
5fe0652099
commit
c271bfd932
2 changed files with 24 additions and 4 deletions
|
@ -254,3 +254,25 @@ class TestCommands(TestCase):
|
|||
self.assertIn(filenames[0], coder.abs_fnames)
|
||||
self.assertNotIn(filenames[1], coder.abs_fnames)
|
||||
self.assertIn(filenames[2], coder.abs_fnames)
|
||||
|
||||
def test_cmd_commit(self):
|
||||
with GitTemporaryDirectory():
|
||||
fname = "test.txt"
|
||||
with open(fname, "w") as f:
|
||||
f.write("test")
|
||||
repo = git.Repo()
|
||||
repo.git.add(fname)
|
||||
repo.git.commit("-m", "initial")
|
||||
|
||||
io = InputOutput(pretty=False, yes=True)
|
||||
coder = Coder.create(models.GPT35, None, io)
|
||||
commands = Commands(io, coder)
|
||||
|
||||
self.assertFalse(repo.is_dirty())
|
||||
with open(fname, "w") as f:
|
||||
f.write("new")
|
||||
self.assertTrue(repo.is_dirty())
|
||||
|
||||
commit_message = "Test commit message"
|
||||
commands.cmd_commit(commit_message)
|
||||
self.assertFalse(repo.is_dirty())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue