Skip to content

Commit 0cbeccf

Browse files
committed
tests: shtab --print-completion
1 parent 7208c42 commit 0cbeccf

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

tests/test_shtab.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,24 @@ def test_main(shell, caplog):
6464
assert not caplog.record_tuples
6565

6666

67+
@fix_shell
68+
def test_main_self_completion(shell, caplog, capsys):
69+
with caplog.at_level(logging.INFO):
70+
try:
71+
main(["--print-completion", shell])
72+
except SystemExit:
73+
pass
74+
75+
captured = capsys.readouterr()
76+
assert not captured.err
77+
expected = {
78+
"bash": "complete -o filenames -F _shtab_shtab shtab", "zsh": "_shtab_shtab_commands()",
79+
"tcsh": "complete shtab"}
80+
assert expected[shell] in captured.out
81+
82+
assert not caplog.record_tuples
83+
84+
6785
@fix_shell
6886
def test_prog_override(shell, caplog, capsys):
6987
with caplog.at_level(logging.INFO):

0 commit comments

Comments
 (0)