mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-27 05:13:10 +00:00
tests: Move fg2.py into fg.py
There's no reason for this to be a separate file.
This commit is contained in:
parent
78358ab351
commit
5152838417
2 changed files with 59 additions and 73 deletions
|
@ -39,3 +39,62 @@ send("\x03")
|
|||
expect_prompt()
|
||||
sendline("set -l foo bar; echo $foo")
|
||||
expect_str("bar")
|
||||
|
||||
expect_prompt()
|
||||
|
||||
# Regression test for #7483.
|
||||
# Ensure we can background a job after a different backgrounded job completes.
|
||||
sendline("sleep 1")
|
||||
sleep(0.1)
|
||||
|
||||
# ctrl-z - send job to background
|
||||
send("\x1A")
|
||||
sleep(0.2)
|
||||
expect_prompt("has stopped")
|
||||
|
||||
# Bring back to fg.
|
||||
sendline("fg")
|
||||
sleep(1.0)
|
||||
|
||||
# Now sleep is done, right?
|
||||
expect_prompt()
|
||||
sendline("jobs")
|
||||
expect_prompt("jobs: There are no jobs")
|
||||
|
||||
# Ensure we can do it again.
|
||||
sendline("sleep 5")
|
||||
sleep(0.2)
|
||||
send("\x1A")
|
||||
sleep(0.1)
|
||||
expect_prompt("has stopped")
|
||||
sendline("fg")
|
||||
sleep(0.1) # allow tty to transfer
|
||||
send("\x03") # control-c to cancel it
|
||||
|
||||
expect_prompt()
|
||||
sendline("jobs")
|
||||
expect_prompt("jobs: There are no jobs")
|
||||
|
||||
# Regression test for #2214: foregrounding from a key binding works!
|
||||
sendline(r"bind \cr 'fg >/dev/null 2>/dev/null'")
|
||||
expect_prompt()
|
||||
sendline("$fish_test_helper print_stop_cont")
|
||||
sleep(0.2)
|
||||
|
||||
send("\x1A") # ctrl-z
|
||||
expect_prompt("SIGTSTP")
|
||||
sleep(0.1)
|
||||
send("\x12") # ctrl-r, placing fth in foreground
|
||||
expect_str("SIGCONT")
|
||||
|
||||
# Do it again.
|
||||
send("\x1A")
|
||||
expect_str("SIGTSTP")
|
||||
sleep(0.1)
|
||||
send("\x12")
|
||||
expect_str("SIGCONT")
|
||||
|
||||
# End fth by sending it anything.
|
||||
send("\x12")
|
||||
sendline("derp")
|
||||
expect_prompt()
|
||||
|
|
|
@ -1,73 +0,0 @@
|
|||
#!/usr/bin/env python3
|
||||
from pexpect_helper import SpawnedProc
|
||||
import subprocess
|
||||
import sys
|
||||
import time
|
||||
|
||||
sp = SpawnedProc()
|
||||
send, sendline, sleep, expect_prompt, expect_re, expect_str = (
|
||||
sp.send,
|
||||
sp.sendline,
|
||||
sp.sleep,
|
||||
sp.expect_prompt,
|
||||
sp.expect_re,
|
||||
sp.expect_str,
|
||||
)
|
||||
expect_prompt()
|
||||
|
||||
# Regression test for #7483.
|
||||
# Ensure we can background a job after a different backgrounded job completes.
|
||||
sendline("sleep 1")
|
||||
sleep(0.1)
|
||||
|
||||
# ctrl-z - send job to background
|
||||
send("\x1A")
|
||||
sleep(0.2)
|
||||
expect_prompt("has stopped")
|
||||
|
||||
# Bring back to fg.
|
||||
sendline("fg")
|
||||
sleep(1.0)
|
||||
|
||||
# Now sleep is done, right?
|
||||
expect_prompt()
|
||||
sendline("jobs")
|
||||
expect_prompt("jobs: There are no jobs")
|
||||
|
||||
# Ensure we can do it again.
|
||||
sendline("sleep 5")
|
||||
sleep(0.2)
|
||||
send("\x1A")
|
||||
sleep(0.1)
|
||||
expect_prompt("has stopped")
|
||||
sendline("fg")
|
||||
sleep(0.1) # allow tty to transfer
|
||||
send("\x03") # control-c to cancel it
|
||||
|
||||
expect_prompt()
|
||||
sendline("jobs")
|
||||
expect_prompt("jobs: There are no jobs")
|
||||
|
||||
# Regression test for #2214: foregrounding from a key binding works!
|
||||
sendline(r"bind \cr 'fg >/dev/null 2>/dev/null'")
|
||||
expect_prompt()
|
||||
sendline("$fish_test_helper print_stop_cont")
|
||||
sleep(0.2)
|
||||
|
||||
send("\x1A") # ctrl-z
|
||||
expect_prompt("SIGTSTP")
|
||||
sleep(0.1)
|
||||
send("\x12") # ctrl-r, placing fth in foreground
|
||||
expect_str("SIGCONT")
|
||||
|
||||
# Do it again.
|
||||
send("\x1A")
|
||||
expect_str("SIGTSTP")
|
||||
sleep(0.1)
|
||||
send("\x12")
|
||||
expect_str("SIGCONT")
|
||||
|
||||
# End fth by sending it anything.
|
||||
send("\x12")
|
||||
sendline("derp")
|
||||
expect_prompt()
|
Loading…
Reference in a new issue