File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1401,7 +1401,10 @@ def test_full_prefix_removal() -> None:
14011401 class TestApp (cmd2 .Cmd ):
14021402 def get_choices (self ) -> Choices :
14031403 """Return choices."""
1404- choices = ["'This is a quoted item'" ]
1404+ choices = [
1405+ "'This is a single-quoted item'" ,
1406+ '"This is a double-quoted item"' ,
1407+ ]
14051408 return cmd2 .Choices .from_values (choices )
14061409
14071410 parser = cmd2 .Cmd2ArgumentParser ()
@@ -1411,8 +1414,22 @@ def get_choices(self) -> Choices:
14111414 def do_command (self , args : argparse .Namespace ) -> None :
14121415 """Test stuff."""
14131416
1417+ # Test single-quoted item
14141418 text = ""
1415- line = "command \" 'This is a quoted item'"
1419+ line = "command \" 'This is a single-quoted item'"
1420+ endidx = len (line )
1421+ begidx = endidx
1422+
1423+ app = TestApp ()
1424+ completions = app .complete (text , line , begidx , endidx )
1425+ assert len (completions ) == 1
1426+
1427+ item = completions [0 ]
1428+ assert item .text == ""
1429+
1430+ # Test double-quoted item
1431+ text = ""
1432+ line = 'command \' "This is a double-quoted item"'
14161433 endidx = len (line )
14171434 begidx = endidx
14181435
You can’t perform that action at this time.
0 commit comments