2020-03-03 07:20:29 +08:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
from pexpect_helper import SpawnedProc
|
|
|
|
|
|
|
|
sp = SpawnedProc()
|
2020-12-06 22:33:04 +08:00
|
|
|
send, sendline, expect_prompt, expect_str = (
|
|
|
|
sp.send,
|
|
|
|
sp.sendline,
|
|
|
|
sp.expect_prompt,
|
|
|
|
sp.expect_str,
|
|
|
|
)
|
2020-06-05 09:13:39 +08:00
|
|
|
|
|
|
|
expect_prompt()
|
|
|
|
sendline("function echo_wrap ; /bin/echo $argv ; sleep 0.1; end")
|
|
|
|
expect_prompt()
|
2020-03-03 07:20:29 +08:00
|
|
|
|
|
|
|
for i in range(5):
|
2020-06-05 09:13:39 +08:00
|
|
|
sendline(
|
2020-03-03 07:20:29 +08:00
|
|
|
"echo_wrap 1 2 3 4 | $fish_test_helper become_foreground_then_print_stderr ; or exit 1"
|
|
|
|
)
|
2020-06-05 09:13:39 +08:00
|
|
|
expect_prompt("become_foreground_then_print_stderr done")
|
2020-03-03 07:20:29 +08:00
|
|
|
|
|
|
|
# 'not' because we expect to have no jobs, in which case `jobs` will return false
|
2020-06-05 09:13:39 +08:00
|
|
|
sendline("not jobs")
|
|
|
|
expect_prompt("jobs: There are no jobs")
|
2020-03-03 07:20:29 +08:00
|
|
|
|
2020-06-05 09:13:39 +08:00
|
|
|
sendline("function inner ; command true ; end; function outer; inner; end")
|
|
|
|
expect_prompt()
|
2020-03-03 07:20:29 +08:00
|
|
|
for i in range(5):
|
2020-06-05 09:13:39 +08:00
|
|
|
sendline(
|
2020-03-03 07:20:29 +08:00
|
|
|
"outer | $fish_test_helper become_foreground_then_print_stderr ; or exit 1"
|
|
|
|
)
|
2020-06-05 09:13:39 +08:00
|
|
|
expect_prompt("become_foreground_then_print_stderr done")
|
2020-03-03 07:20:29 +08:00
|
|
|
|
2020-06-05 09:13:39 +08:00
|
|
|
sendline("not jobs")
|
|
|
|
expect_prompt("jobs: There are no jobs", unmatched="Should be no jobs")
|
2020-12-06 21:02:08 +08: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-20 04:11:28 +08:00
|
|
|
expect_str("warning: Path '/non' does not exist")
|
2020-12-06 21:02:08 +08:00
|
|
|
send("\x04")
|
|
|
|
expect_prompt()
|