@@ -689,26 +689,27 @@ def test_tokens_for_completion_unclosed_quote(cmd2_app):
689
689
assert expected_tokens == tokens
690
690
assert expected_raw_tokens == raw_tokens
691
691
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 )
695
696
endidx = len (line )
696
697
begidx = endidx - len (text )
697
698
698
- expected_tokens = ['command' , '|' , '<' , '>>' , 'file' ]
699
- expected_raw_tokens = ['command' , '|' , '<' , '>>' , 'file' ]
699
+ expected_tokens = ['command' , '|' , '<' , ';' , ' >>' , 'file' ]
700
+ expected_raw_tokens = ['command' , '|' , '<' , ';' , ' >>' , 'file' ]
700
701
701
702
tokens , raw_tokens = cmd2_app .tokens_for_completion (line , begidx , endidx )
702
703
assert expected_tokens == tokens
703
704
assert expected_raw_tokens == raw_tokens
704
705
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"""
706
708
text = '>file'
707
709
line = 'command "{}' .format (text )
708
710
endidx = len (line )
709
711
begidx = endidx - len (text )
710
712
711
- cmd2_app .statement_parser .redirection = True
712
713
expected_tokens = ['command' , '>file' ]
713
714
expected_raw_tokens = ['command' , '">file' ]
714
715
0 commit comments