2020-03-03 07:20:29 +08:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
from pexpect_helper import SpawnedProc
|
|
|
|
|
|
|
|
sp = SpawnedProc()
|
2020-06-05 09:13:39 +08:00
|
|
|
sendline, expect_prompt = sp.sendline, sp.expect_prompt
|
|
|
|
|
|
|
|
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")
|