From 49c52823b0c802e0fc8e4f18d517f766f7f43cfc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Tue, 19 Sep 2023 11:36:47 +0200 Subject: Fix backslashes "eating" their next character. Since we are working with literal characters, than a backslash shouldn't be removed when esacping a character. The current (and excpeted) functionallity is that the backslash should escape the next character, but print both. Also added tests for this. --- tests/test_string.py | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 tests/test_string.py (limited to 'tests') diff --git a/tests/test_string.py b/tests/test_string.py new file mode 100644 index 0000000..5d3040b --- /dev/null +++ b/tests/test_string.py @@ -0,0 +1,6 @@ +from rainbow_parenthesis import colorize, Colored +import io + + +def test_escaped_parenthesis(): + assert list(r"\(") == list(colorize(io.StringIO(r"\("))) -- cgit v1.2.3