diff --git a/tests/test_prompt.py b/tests/test_prompt.py index 3f09a37..000c8bd 100644 --- a/tests/test_prompt.py +++ b/tests/test_prompt.py @@ -43,6 +43,15 @@ class TestSubstitutePlaceholders: result = substitute_placeholders("Hello \\\\\\{name.txt}", project_dir) assert result == "Hello \\{name.txt}" + def test_nine_backslashes_before_placeholder(self, project_dir: Path) -> None: + """Nine backslashes (odd) → 4 literal backslashes + literal {file.txt}.""" + _ = (project_dir / "file.txt").write_text("content") + # 9 backslashes before {file.txt}: odd → escaped, halve to 4 + result = substitute_placeholders( + "\\\\\\\\\\\\\\\\\\" + "{file.txt}", project_dir + ) + assert result == "\\\\\\\\{file.txt}" + def test_placeholder_at_start(self, project_dir: Path) -> None: _ = (project_dir / "greeting.txt").write_text("Hi there") result = substitute_placeholders("{greeting.txt}!", project_dir)