(cmd2_app)
| 356 | |
| 357 | |
| 358 | def test_shell_command_completion_shortcut(cmd2_app) -> None: |
| 359 | # Made sure ! runs a shell command and all matches start with ! since there |
| 360 | # isn't a space between ! and the shell command. Display matches won't |
| 361 | # begin with the !. |
| 362 | if sys.platform == "win32": |
| 363 | text = "!calc" |
| 364 | expected_item = CompletionItem("!calc.exe", display="calc.exe") |
| 365 | else: |
| 366 | text = "!egr" |
| 367 | expected_item = CompletionItem("!egrep", display="egrep") |
| 368 | |
| 369 | expected_completions = Completions([expected_item]) |
| 370 | |
| 371 | line = text |
| 372 | endidx = len(line) |
| 373 | begidx = 0 |
| 374 | |
| 375 | completions = cmd2_app.complete(text, line, begidx, endidx) |
| 376 | assert completions.to_strings() == expected_completions.to_strings() |
| 377 | assert [item.display for item in completions] == [item.display for item in expected_completions] |
| 378 | |
| 379 | |
| 380 | def test_shell_command_completion_does_not_match_wildcards(cmd2_app) -> None: |
nothing calls this directly
no test coverage detected
searching dependent graphs…