From 8f0e49ee6f511a2b0c8727e6da3d9732cd729a61 Mon Sep 17 00:00:00 2001 From: Konstantin Fickel Date: Fri, 20 Feb 2026 21:13:57 +0100 Subject: [PATCH] test: add nine-backslash escape test for prompt placeholders --- tests/test_prompt.py | 9 +++++++++ 1 file changed, 9 insertions(+) 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)