Skip to content

Commit b8d5b96

Browse files
committed
Added more code coverage of shell_cmd_complete
1 parent c7c0d14 commit b8d5b96

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

tests/test_completion.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,21 @@ def test_shell_command_completion_does_path_completion_when_after_command(cmd2_a
257257
first_match = complete_tester(text, line, begidx, endidx, cmd2_app)
258258
assert first_match is not None and cmd2_app.completion_matches == [text + '.py ']
259259

260+
def test_shell_commmand_complete_in_path(cmd2_app, request):
261+
test_dir = os.path.dirname(request.module.__file__)
262+
263+
text = os.path.join(test_dir, 's')
264+
line = 'shell {}'.format(text)
265+
266+
endidx = len(line)
267+
begidx = endidx - len(text)
268+
269+
# Since this will look for directories and executables in the given path,
270+
# we expect to see the scripts dir among the results
271+
expected = os.path.join(test_dir, 'scripts' + os.path.sep)
272+
first_match = complete_tester(text, line, begidx, endidx, cmd2_app)
273+
assert first_match is not None and expected in cmd2_app.completion_matches
274+
260275

261276
def test_path_completion_single_end(cmd2_app, request):
262277
test_dir = os.path.dirname(request.module.__file__)

0 commit comments

Comments
 (0)