fish-shell/tests/pexpects/complete.py

29 lines
636 B
Python
Raw Normal View History

2020-06-08 15:16:09 +00:00
#!/usr/bin/env python3
from pexpect_helper import SpawnedProc
2020-06-08 15:16:09 +00:00
sp = SpawnedProc()
send, sendline, sleep, expect_prompt, expect_re = (
sp.send,
sp.sendline,
sp.sleep,
sp.expect_prompt,
sp.expect_re,
)
2020-06-08 15:16:09 +00:00
expect_prompt()
sendline(
"""
complete -c my_is -n 'test (count (commandline -opc)) = 1' -xa arg
complete -c my_is -n '__fish_seen_subcommand_from not' -xa '(
set -l cmd (commandline -opc) (commandline -ct)
set cmd (string join " " my_is $cmd[3..-1])" "
commandline --replace --current-process $cmd
complete -C"$cmd"
)'
"""
)
2020-06-08 15:16:09 +00:00
send("my_is not \t")
send("still.alive")
expect_re(".*still.alive")