| 161 | |
| 162 | |
| 163 | def test_escape_escape(): |
| 164 | # Escaped escapes (i.e. double backslash)should be treated as literal |
| 165 | result = render(r"\\[bold]FOO") |
| 166 | assert str(result) == r"\FOO" |
| 167 | |
| 168 | # Single backslash makes the tag literal |
| 169 | result = render(r"\[bold]FOO") |
| 170 | assert str(result) == "[bold]FOO" |
| 171 | |
| 172 | # Double backslash produces a backslash |
| 173 | result = render(r"\\[bold]some text[/]") |
| 174 | assert str(result) == r"\some text" |
| 175 | |
| 176 | # Triple backslash parsed as literal backslash plus escaped tag |
| 177 | result = render(r"\\\[bold]some text\[/]") |
| 178 | assert str(result) == r"\[bold]some text[/]" |
| 179 | |
| 180 | # Backslash escaping only happens when preceding a tag |
| 181 | result = render(r"\\") |
| 182 | assert str(result) == r"\\" |
| 183 | |
| 184 | result = render(r"\\\\") |
| 185 | assert str(result) == r"\\\\" |
| 186 | |
| 187 | |
| 188 | def test_events(): |