mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-27 21:33:09 +00:00
Test flow control
This is a bit of an interesting pexpect test, but honestly pexpect works quite well! I'm happy with it!
This commit is contained in:
parent
81af5b7ff3
commit
d6a77cc6f7
1 changed files with 31 additions and 1 deletions
|
@ -3,7 +3,14 @@ from pexpect_helper import SpawnedProc
|
|||
|
||||
# Set a 0 terminal size
|
||||
sp = SpawnedProc(args=["-d", "term-support"], dimensions=(0,0))
|
||||
sendline, expect_prompt, expect_str = sp.sendline, sp.expect_prompt, sp.expect_str
|
||||
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()
|
||||
# Now confirm it defaulted to 80x24
|
||||
|
@ -13,3 +20,26 @@ expect_str("term-support: Terminal has 0 columns, falling back to default width"
|
|||
expect_str("term-support: Terminal has 0 rows, falling back to default height")
|
||||
expect_prompt()
|
||||
|
||||
sendline("stty -a")
|
||||
expect_prompt()
|
||||
# Confirm flow control in the shell is disabled - we should ignore the ctrl-s in there.
|
||||
sendline("echo hello\x13hello")
|
||||
expect_prompt("hellohello")
|
||||
|
||||
# Confirm it is off for external commands
|
||||
sendline("stty -a | string match -q '*-ixon -ixoff*'; echo $status")
|
||||
expect_prompt("0")
|
||||
|
||||
# Turn flow control on
|
||||
sendline("stty ixon ixoff")
|
||||
expect_prompt()
|
||||
sendline("stty -a | string match -q '*ixon ixoff*'; echo $status")
|
||||
expect_prompt("0")
|
||||
|
||||
# Confirm flow control in the shell is disabled - we should ignore the ctrl-s in there.
|
||||
sendline("echo hello\x13hello")
|
||||
# This should not match because we should not get any output.
|
||||
# Unfortunately we have to wait for the timeout to expire - set it to a second.
|
||||
expect_str("hellohello", timeout=1, shouldfail=True)
|
||||
send("\x11") # ctrl-q to resume flow
|
||||
expect_prompt("hellohello")
|
||||
|
|
Loading…
Reference in a new issue