Skip to content

Commit 0cd9501

Browse files
committed
add tests for user scripts
1 parent 89e3474 commit 0cd9501

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

tests/test_shtab.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,31 @@ def test_prog_override(shell, caplog, capsys):
9191
assert not caplog.record_tuples
9292

9393

94+
@fix_shell
95+
def test_prog_scripts(shell, caplog, capsys):
96+
with caplog.at_level(logging.INFO):
97+
main(
98+
["-s", shell, "--prog", "script.py", "shtab.main.get_main_parser"]
99+
)
100+
101+
captured = capsys.readouterr()
102+
assert not captured.err
103+
script_py = [
104+
i.strip() for i in captured.out.splitlines() if "script.py" in i
105+
]
106+
if shell == "bash":
107+
assert script_py == ["complete -o nospace -F _shtab_shtab script.py"]
108+
elif shell == "zsh":
109+
assert script_py == [
110+
"#compdef script.py",
111+
"_describe 'script.py commands' _commands",
112+
]
113+
else:
114+
raise NotImplementedError(shell)
115+
116+
assert not caplog.record_tuples
117+
118+
94119
@fix_shell
95120
def test_prefix_override(shell, caplog, capsys):
96121
with caplog.at_level(logging.INFO):

0 commit comments

Comments
 (0)