diff options
author | kotfu <kotfu@kotfu.net> | 2018-08-08 21:33:13 -0600 |
---|---|---|
committer | kotfu <kotfu@kotfu.net> | 2018-08-08 21:33:13 -0600 |
commit | 34784566f926b57234388150a550ca005f6f3ef9 (patch) | |
tree | 13a9f8ab97ac1bf2d496ccd3bfd8cfe105064666 /tests | |
parent | ad09ee3d3bd87c3dddefa890f8dad03bcb4c143c (diff) | |
download | cmd2-git-34784566f926b57234388150a550ca005f6f3ef9.tar.gz |
Allow newlines inside unclosed quotes. Fixes #495
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_cmd2.py | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/tests/test_cmd2.py b/tests/test_cmd2.py index 3324a105..0ec993e9 100644 --- a/tests/test_cmd2.py +++ b/tests/test_cmd2.py @@ -1471,7 +1471,8 @@ def test_multiline_complete_empty_statement_raises_exception(multiline_app): multiline_app._complete_statement('') def test_multiline_complete_statement_without_terminator(multiline_app): - # Mock out the input call so we don't actually wait for a user's response on stdin when it looks for more input + # Mock out the input call so we don't actually wait for a user's response + # on stdin when it looks for more input m = mock.MagicMock(name='input', return_value='\n') builtins.input = m @@ -1481,6 +1482,20 @@ def test_multiline_complete_statement_without_terminator(multiline_app): statement = multiline_app._complete_statement(line) assert statement == args assert statement.command == command + assert statement.multiline_command == command + +def test_multiline_complete_statement_with_unclosed_quotes(multiline_app): + # Mock out the input call so we don't actually wait for a user's response + # on stdin when it looks for more input + m = mock.MagicMock(name='input', side_effect=['quotes', '" now closed;']) + builtins.input = m + + line = 'orate hi "partially open' + statement = multiline_app._complete_statement(line) + assert statement == 'hi "partially open\nquotes\n" now closed' + assert statement.command == 'orate' + assert statement.multiline_command == 'orate' + assert statement.terminator == ';' def test_clipboard_failure(base_app, capsys): |