mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-21 12:55:00 +00:00
feat: Improve history, faq, and linter tests for Windows and special chars
This commit is contained in:
parent
4ec075d290
commit
c72e5fcc5e
5 changed files with 51 additions and 9 deletions
|
@ -41,6 +41,7 @@ class TestLinter(unittest.TestCase):
|
|||
if os.name != "nt":
|
||||
self.skipTest("This test only runs on Windows")
|
||||
from pathlib import Path
|
||||
|
||||
root = Path(__file__).parent.parent.parent.absolute().as_posix()
|
||||
linter = Linter(encoding="utf-8", root=root)
|
||||
result = linter.run_cmd("dir", "tests\\basic", "code")
|
||||
|
@ -57,6 +58,27 @@ class TestLinter(unittest.TestCase):
|
|||
self.assertIsNotNone(result)
|
||||
self.assertIn("Error message", result.text)
|
||||
|
||||
def test_run_cmd_with_special_chars(self):
|
||||
with patch("subprocess.Popen") as mock_popen:
|
||||
mock_process = MagicMock()
|
||||
mock_process.returncode = 1
|
||||
mock_process.stdout.read.side_effect = ("Error message", None)
|
||||
mock_popen.return_value = mock_process
|
||||
|
||||
# Test with a file path containing special characters
|
||||
special_path = "src/(main)/product/[id]/page.tsx"
|
||||
result = self.linter.run_cmd("eslint", special_path, "code")
|
||||
|
||||
# Verify that the command was constructed correctly
|
||||
mock_popen.assert_called_once()
|
||||
call_args = mock_popen.call_args[0][0]
|
||||
|
||||
self.assertIn(special_path, call_args)
|
||||
|
||||
# The result should contain the error message
|
||||
self.assertIsNotNone(result)
|
||||
self.assertIn("Error message", result.text)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue