aboutsummaryrefslogtreecommitdiff
path: root/tests/test_string.py
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2023-09-19 11:40:54 +0200
committerHugo Hörnquist <hugo@lysator.liu.se>2023-09-19 11:40:54 +0200
commite635c33d0d336e7be54336ed2d6e043470f00398 (patch)
treefe9d07f194aff058e1554e644f6b1ee8da96fb48 /tests/test_string.py
parentFix backslashes "eating" their next character. (diff)
downloadrainbow-parenthesis-e635c33d0d336e7be54336ed2d6e043470f00398.tar.gz
rainbow-parenthesis-e635c33d0d336e7be54336ed2d6e043470f00398.tar.xz
Fix "string mode".
Previously parenthesis were (incorrectly) highlighted even in strings. Now they are correctly ignored inside.
Diffstat (limited to '')
-rw-r--r--tests/test_string.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/test_string.py b/tests/test_string.py
index 5d3040b..1101d26 100644
--- a/tests/test_string.py
+++ b/tests/test_string.py
@@ -4,3 +4,19 @@ import io
def test_escaped_parenthesis():
assert list(r"\(") == list(colorize(io.StringIO(r"\(")))
+
+
+def test_escaped_parenthesis_in_string():
+ assert list(r"'\('") == list(colorize(io.StringIO(r"'\('")))
+
+
+def test_escaped_quot_in_string():
+ assert list(r"'\''") == list(colorize(io.StringIO(r"'\''")))
+
+
+def test_embedded_string():
+ assert list(colorize(io.StringIO("( '(' )"))) == [
+ Colored(depth=0, item='('),
+ *" '(' ",
+ Colored(depth=0, item=')'),
+ ]