summaryrefslogtreecommitdiff
path: root/tests/test_transcript.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_transcript.py')
-rw-r--r--tests/test_transcript.py22
1 files changed, 21 insertions, 1 deletions
diff --git a/tests/test_transcript.py b/tests/test_transcript.py
index adc162b1..fef28c7b 100644
--- a/tests/test_transcript.py
+++ b/tests/test_transcript.py
@@ -15,7 +15,8 @@ import six
# Used for sm.input: raw_input() for Python 2 or input() for Python 3
import six.moves as sm
-from cmd2 import Cmd, make_option, options, Cmd2TestCase, set_use_arg_list, set_posix_shlex, set_strip_quotes
+from cmd2 import (Cmd, make_option, options, Cmd2TestCase, set_use_arg_list,
+ set_posix_shlex, set_strip_quotes)
from conftest import run_cmd, StdOut, normalize
@@ -279,3 +280,22 @@ def test_transcript(request, capsys, filename, feedback_to_output):
else:
assert err == ''
assert out == ''
+
+
+@pytest.mark.parametrize('expected, transformed', [
+ ( 'text with no slashes', 'text\ with\ no\ slashes'),
+ ( 'specials .*', 'specials\ \.\*'),
+ ( '/.*/', '.*'),
+ ( 'specials ^ and + /[0-9]+/', 'specials\ \^\ and\ \+\ [0-9]+'),
+ ( '/a{6}/ but not a{6} with /.*?/ more', 'a{6}\ but\ not\ a\{6\}\ with\ .*?\ more'),
+ ])
+def test_parse_transcript_expected(expected, transformed):
+ app = CmdLineApp()
+
+ class TestMyAppCase(Cmd2TestCase):
+ cmdapp = app
+
+ testcase = TestMyAppCase()
+
+ assert testcase._transform_transcript_expected(expected) == transformed
+