fix: Normalize file path separators for Windows in test_repo_map_sample_code_base

This commit is contained in:
Paul Gauthier (aider) 2024-08-23 11:39:57 -07:00
parent 2d5b481205
commit 97a75ea471

View file

@ -457,6 +457,12 @@ class TestRepoMapAllLanguages(unittest.TestCase):
with open(expected_map_file, "r", encoding="utf-8") as f:
expected_map = f.read().strip()
# Normalize path separators for Windows
if os.name == 'nt': # Check if running on Windows
import re
expected_map = re.sub(r'tests/fixtures/sample-code-base/([^:]+)', r'tests\\fixtures\\sample-code-base\\\1', expected_map)
generated_map_str = re.sub(r'tests/fixtures/sample-code-base/([^:]+)', r'tests\\fixtures\\sample-code-base\\\1', generated_map_str)
# Compare the generated map with the expected map
if generated_map_str != expected_map:
# If they differ, show the differences and fail the test