2021-10-13 19:34:59 +05:30
|
|
|
import re
|
|
|
|
|
|
|
|
import pytest
|
|
|
|
|
|
|
|
from xonsh.procs.specs import cmds_to_specs
|
|
|
|
from xonsh.tracer import tracermain
|
|
|
|
|
|
|
|
|
|
|
|
def test_tracer_help(capsys, xsh_with_aliases):
|
|
|
|
"""verify can invoke it, and usage knows about all the options"""
|
|
|
|
spec = cmds_to_specs([("trace", "-h")], captured="stdout")[0]
|
|
|
|
with pytest.raises(SystemExit):
|
|
|
|
tracermain(["-h"], spec=spec)
|
|
|
|
capout = capsys.readouterr().out
|
|
|
|
pat = re.compile(r"^usage:\s*trace[^\n]*{([\w,-]+)}", re.MULTILINE)
|
|
|
|
m = pat.match(capout)
|
|
|
|
assert m[1]
|
2021-12-07 01:12:26 +05:30
|
|
|
verbs = {v.strip().lower() for v in m[1].split(",")}
|
2021-10-13 19:34:59 +05:30
|
|
|
assert verbs == {"rm", "start", "add", "on", "off", "del", "color", "stop", "ls"}
|