test: add nine-backslash escape test for prompt placeholders
This commit is contained in:
parent
3de3614433
commit
8f0e49ee6f
1 changed files with 9 additions and 0 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue