summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin Van Brunt <kmvanbrunt@gmail.com>2019-08-02 16:53:22 -0400
committerKevin Van Brunt <kmvanbrunt@gmail.com>2019-08-02 16:53:22 -0400
commitf1c87a9c220d3a904570f119c6a80bdef225008a (patch)
tree07380a7ced0b7499f97d90ed9f6510dcb47ed966
parente617970b58cfe711108ba951050f72761c5a6419 (diff)
downloadcmd2-git-f1c87a9c220d3a904570f119c6a80bdef225008a.tar.gz
Updated unit tests
-rwxr-xr-xtests/test_completion.py15
1 files changed, 8 insertions, 7 deletions
diff --git a/tests/test_completion.py b/tests/test_completion.py
index dcca1c7d..cf5dcf75 100755
--- a/tests/test_completion.py
+++ b/tests/test_completion.py
@@ -689,26 +689,27 @@ def test_tokens_for_completion_unclosed_quote(cmd2_app):
assert expected_tokens == tokens
assert expected_raw_tokens == raw_tokens
-def test_tokens_for_completion_redirect(cmd2_app):
- text = '>>file'
- line = 'command | < {}'.format(text)
+def test_tokens_for_completion_punctuation(cmd2_app):
+ """Test that redirectors and terminators are word delimiters"""
+ text = 'file'
+ line = 'command | < ;>>{}'.format(text)
endidx = len(line)
begidx = endidx - len(text)
- expected_tokens = ['command', '|', '<', '>>', 'file']
- expected_raw_tokens = ['command', '|', '<', '>>', 'file']
+ expected_tokens = ['command', '|', '<', ';', '>>', 'file']
+ expected_raw_tokens = ['command', '|', '<', ';', '>>', 'file']
tokens, raw_tokens = cmd2_app.tokens_for_completion(line, begidx, endidx)
assert expected_tokens == tokens
assert expected_raw_tokens == raw_tokens
-def test_tokens_for_completion_quoted_redirect(cmd2_app):
+def test_tokens_for_completion_quoted_punctuation(cmd2_app):
+ """Test that quoted punctuation characters are not word delimiters"""
text = '>file'
line = 'command "{}'.format(text)
endidx = len(line)
begidx = endidx - len(text)
- cmd2_app.statement_parser.redirection = True
expected_tokens = ['command', '>file']
expected_raw_tokens = ['command', '">file']