Skip to content

Commit f1c87a9

Browse files
committed
Updated unit tests
1 parent e617970 commit f1c87a9

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

tests/test_completion.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -689,26 +689,27 @@ def test_tokens_for_completion_unclosed_quote(cmd2_app):
689689
assert expected_tokens == tokens
690690
assert expected_raw_tokens == raw_tokens
691691

692-
def test_tokens_for_completion_redirect(cmd2_app):
693-
text = '>>file'
694-
line = 'command | < {}'.format(text)
692+
def test_tokens_for_completion_punctuation(cmd2_app):
693+
"""Test that redirectors and terminators are word delimiters"""
694+
text = 'file'
695+
line = 'command | < ;>>{}'.format(text)
695696
endidx = len(line)
696697
begidx = endidx - len(text)
697698

698-
expected_tokens = ['command', '|', '<', '>>', 'file']
699-
expected_raw_tokens = ['command', '|', '<', '>>', 'file']
699+
expected_tokens = ['command', '|', '<', ';', '>>', 'file']
700+
expected_raw_tokens = ['command', '|', '<', ';', '>>', 'file']
700701

701702
tokens, raw_tokens = cmd2_app.tokens_for_completion(line, begidx, endidx)
702703
assert expected_tokens == tokens
703704
assert expected_raw_tokens == raw_tokens
704705

705-
def test_tokens_for_completion_quoted_redirect(cmd2_app):
706+
def test_tokens_for_completion_quoted_punctuation(cmd2_app):
707+
"""Test that quoted punctuation characters are not word delimiters"""
706708
text = '>file'
707709
line = 'command "{}'.format(text)
708710
endidx = len(line)
709711
begidx = endidx - len(text)
710712

711-
cmd2_app.statement_parser.redirection = True
712713
expected_tokens = ['command', '>file']
713714
expected_raw_tokens = ['command', '">file']
714715

0 commit comments

Comments
 (0)