mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-20 04:14:59 +00:00
refactor: Move resolve_aiderignore_path to top level and add tests
This commit is contained in:
parent
ffe89362ab
commit
1ec257278e
2 changed files with 31 additions and 9 deletions
|
@ -927,6 +927,27 @@ class TestMain(TestCase):
|
|||
repo = git.Repo(git_dir) # Re-open repo to ensure we get fresh config
|
||||
self.assertEqual(repo.git.config("user.name"), "Directive User")
|
||||
self.assertEqual(repo.git.config("user.email"), "directive@example.com")
|
||||
|
||||
def test_resolve_aiderignore_path(self):
|
||||
# Import the function directly to test it
|
||||
from aider.args import resolve_aiderignore_path
|
||||
|
||||
# Test with absolute path
|
||||
abs_path = os.path.abspath("/tmp/test/.aiderignore")
|
||||
self.assertEqual(resolve_aiderignore_path(abs_path), abs_path)
|
||||
|
||||
# Test with relative path and git root
|
||||
git_root = "/path/to/git/root"
|
||||
rel_path = ".aiderignore"
|
||||
expected = os.path.join(git_root, rel_path)
|
||||
self.assertEqual(
|
||||
resolve_aiderignore_path(rel_path, git_root),
|
||||
str(Path(git_root) / rel_path)
|
||||
)
|
||||
|
||||
# Test with relative path and no git root
|
||||
rel_path = ".aiderignore"
|
||||
self.assertEqual(resolve_aiderignore_path(rel_path), rel_path)
|
||||
|
||||
def test_invalid_edit_format(self):
|
||||
with GitTemporaryDirectory():
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue