2020-03-02 23:20:29 +00:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
from pexpect_helper import SpawnedProc
|
|
|
|
|
|
|
|
sp = SpawnedProc()
|
2020-12-06 14:33:04 +00:00
|
|
|
send, sendline, expect_prompt, expect_str = (
|
|
|
|
sp.send,
|
|
|
|
sp.sendline,
|
|
|
|
sp.expect_prompt,
|
|
|
|
sp.expect_str,
|
|
|
|
)
|
2020-06-05 01:13:39 +00:00
|
|
|
|
|
|
|
expect_prompt()
|
|
|
|
sendline("function echo_wrap ; /bin/echo $argv ; sleep 0.1; end")
|
|
|
|
expect_prompt()
|
2020-03-02 23:20:29 +00:00
|
|
|
|
|
|
|
for i in range(5):
|
2020-06-05 01:13:39 +00:00
|
|
|
sendline(
|
2020-03-02 23:20:29 +00:00
|
|
|
"echo_wrap 1 2 3 4 | $fish_test_helper become_foreground_then_print_stderr ; or exit 1"
|
|
|
|
)
|
2020-06-05 01:13:39 +00:00
|
|
|
expect_prompt("become_foreground_then_print_stderr done")
|
2020-03-02 23:20:29 +00:00
|
|
|
|
|
|
|
# 'not' because we expect to have no jobs, in which case `jobs` will return false
|
2020-06-05 01:13:39 +00:00
|
|
|
sendline("not jobs")
|
|
|
|
expect_prompt("jobs: There are no jobs")
|
2020-03-02 23:20:29 +00:00
|
|
|
|
2020-06-05 01:13:39 +00:00
|
|
|
sendline("function inner ; command true ; end; function outer; inner; end")
|
|
|
|
expect_prompt()
|
2020-03-02 23:20:29 +00:00
|
|
|
for i in range(5):
|
2020-06-05 01:13:39 +00:00
|
|
|
sendline(
|
2020-03-02 23:20:29 +00:00
|
|
|
"outer | $fish_test_helper become_foreground_then_print_stderr ; or exit 1"
|
|
|
|
)
|
2020-06-05 01:13:39 +00:00
|
|
|
expect_prompt("become_foreground_then_print_stderr done")
|
2020-03-02 23:20:29 +00:00
|
|
|
|
2020-06-05 01:13:39 +00:00
|
|
|
sendline("not jobs")
|
|
|
|
expect_prompt("jobs: There are no jobs", unmatched="Should be no jobs")
|
2020-12-06 13:02:08 +00:00
|
|
|
|
|
|
|
# Check that this weird invalid double-redirection doesn't crash fish.
|
|
|
|
sendline("cat | cat </non/existent/file")
|
|
|
|
expect_str("warning: An error occurred while redirecting file '/non/existent/file'")
|
2021-11-19 20:11:28 +00:00
|
|
|
expect_str("warning: Path '/non' does not exist")
|
2020-12-06 13:02:08 +00:00
|
|
|
send("\x04")
|
|
|
|
expect_prompt()
|