aboutsummaryrefslogtreecommitdiffstats
path: root/test/mitmproxy/test_command_lexer.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/mitmproxy/test_command_lexer.py')
-rw-r--r--test/mitmproxy/test_command_lexer.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/mitmproxy/test_command_lexer.py b/test/mitmproxy/test_command_lexer.py
index 3f009f88..cdda1085 100644
--- a/test/mitmproxy/test_command_lexer.py
+++ b/test/mitmproxy/test_command_lexer.py
@@ -1,5 +1,7 @@
import pyparsing
import pytest
+from hypothesis import given, example
+from hypothesis.strategies import text
from mitmproxy import command_lexer
@@ -36,3 +38,14 @@ def test_partial_quoted_string(test_input, valid):
)
def test_expr(test_input, expected):
assert list(command_lexer.expr.parseString(test_input, parseAll=True)) == expected
+
+
+@given(text())
+def test_quote_unquote_cycle(s):
+ assert command_lexer.unquote(command_lexer.quote(s)) == s
+
+
+@given(text())
+@example("'foo\\'")
+def test_unquote_never_fails(s):
+ command_lexer.unquote(s)