mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-08 02:31:18 -03:00
Reformat
This commit is contained in:
@@ -309,5 +309,5 @@ expect_prompt("\nb c d")
|
||||
# Check that ctrl-z can be bound
|
||||
sendline('bind \cz "echo bound ctrl-z"')
|
||||
expect_prompt()
|
||||
send('\x1A')
|
||||
send("\x1A")
|
||||
expect_str("bound ctrl-z")
|
||||
|
||||
@@ -4,7 +4,13 @@ from pexpect_helper import SpawnedProc
|
||||
import signal
|
||||
|
||||
sp = SpawnedProc()
|
||||
send, sendline, sleep, expect_str, expect_prompt = sp.send, sp.sendline, sp.sleep, sp.expect_str, sp.expect_prompt
|
||||
send, sendline, sleep, expect_str, expect_prompt = (
|
||||
sp.send,
|
||||
sp.sendline,
|
||||
sp.sleep,
|
||||
sp.expect_str,
|
||||
sp.expect_prompt,
|
||||
)
|
||||
expect_prompt()
|
||||
|
||||
# Verify that cancel-commandline does what we expect - see #7384.
|
||||
|
||||
@@ -50,9 +50,11 @@ expect_prompt()
|
||||
# Verify that asking to exit a second time does so.
|
||||
send("exit\r")
|
||||
|
||||
for t in range(0,3):
|
||||
for t in range(0, 3):
|
||||
proc = subprocess.run(
|
||||
["pgrep", "-l", "-f", "sleep 11"], stdout=subprocess.PIPE, stderr=subprocess.PIPE
|
||||
["pgrep", "-l", "-f", "sleep 11"],
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE,
|
||||
)
|
||||
if proc.returncode != 0:
|
||||
break
|
||||
|
||||
@@ -18,11 +18,13 @@ expect_prompt()
|
||||
sendline("test -t 0; echo $status")
|
||||
expect_prompt("0")
|
||||
|
||||
sendline("""function t
|
||||
sendline(
|
||||
"""function t
|
||||
test -t 0 && echo stdin
|
||||
test -t 1 && echo stdout
|
||||
test -t 2 && echo stderr
|
||||
end""")
|
||||
end"""
|
||||
)
|
||||
expect_prompt()
|
||||
|
||||
sendline("t")
|
||||
|
||||
@@ -40,7 +40,7 @@ expect_re("Job.*Group.*(CPU)?.*State.*Command")
|
||||
expect_re(".*running.*sleep 20 &")
|
||||
expect_prompt()
|
||||
sendline("echo $my_pid")
|
||||
m = expect_re('\d+\r\n')
|
||||
m = expect_re("\d+\r\n")
|
||||
expect_prompt()
|
||||
os.kill(int(m.group()), signal.SIGTERM)
|
||||
expect_re("[0-9]+:0:sleep 20 &:SIGTERM:Polite quit request", timeout=20)
|
||||
|
||||
@@ -7,7 +7,9 @@ sendline, expect_prompt, expect_str = sp.sendline, sp.expect_prompt, sp.expect_s
|
||||
# Test fish_postexec and $status_generation for interactive shells.
|
||||
expect_prompt()
|
||||
|
||||
sendline("function test_fish_postexec --on-event fish_postexec; printf 'pipestatus:%s, generation:%d, command:%s\\n' (string join '|' $pipestatus) $status_generation $argv; end")
|
||||
sendline(
|
||||
"function test_fish_postexec --on-event fish_postexec; printf 'pipestatus:%s, generation:%d, command:%s\\n' (string join '|' $pipestatus) $status_generation $argv; end"
|
||||
)
|
||||
expect_prompt()
|
||||
|
||||
generation = 1
|
||||
@@ -38,7 +40,9 @@ expect_prompt()
|
||||
|
||||
# multiple backgrounded jobs
|
||||
sendline("sleep 1000 &; sleep 2000 &")
|
||||
expect_str("pipestatus:0|1, generation:%d, command:sleep 1000 &; sleep 2000 &" % generation)
|
||||
expect_str(
|
||||
"pipestatus:0|1, generation:%d, command:sleep 1000 &; sleep 2000 &" % generation
|
||||
)
|
||||
expect_prompt()
|
||||
|
||||
# valid variable assignment
|
||||
@@ -48,18 +52,25 @@ expect_prompt()
|
||||
|
||||
# valid variable assignment with background job
|
||||
sendline("set foo bar; sleep 1000 &")
|
||||
expect_str("pipestatus:0|1, generation:%d, command:set foo bar; sleep 1000 &" % generation)
|
||||
expect_str(
|
||||
"pipestatus:0|1, generation:%d, command:set foo bar; sleep 1000 &" % generation
|
||||
)
|
||||
expect_prompt()
|
||||
|
||||
# Increments $status_generation if any job was foreground.
|
||||
sendline("false|true; sleep 1000 &")
|
||||
generation += 1
|
||||
expect_str("pipestatus:1|0, generation:%d, command:false|true; sleep 1000 &" % generation)
|
||||
expect_str(
|
||||
"pipestatus:1|0, generation:%d, command:false|true; sleep 1000 &" % generation
|
||||
)
|
||||
expect_prompt()
|
||||
|
||||
sendline("sleep 1000 &; true|false|true")
|
||||
generation += 1
|
||||
expect_str("pipestatus:0|1|0, generation:%d, command:sleep 1000 &; true|false|true" % generation)
|
||||
expect_str(
|
||||
"pipestatus:0|1|0, generation:%d, command:sleep 1000 &; true|false|true"
|
||||
% generation
|
||||
)
|
||||
expect_prompt()
|
||||
|
||||
# Increments $status_generation for empty if/while blocks.
|
||||
@@ -83,7 +94,9 @@ expect_prompt()
|
||||
# This is an implementation detail, but the test case should prevent regressions.
|
||||
sendline("function fail; false; end")
|
||||
generation += 1
|
||||
expect_str("pipestatus:0, generation:%d, command:function fail; false; end" % generation)
|
||||
expect_str(
|
||||
"pipestatus:0, generation:%d, command:function fail; false; end" % generation
|
||||
)
|
||||
expect_prompt()
|
||||
|
||||
# or an invalid variable assignment
|
||||
@@ -111,15 +124,24 @@ expect_prompt()
|
||||
|
||||
# Or begin/end block with only backgrounded jobs.
|
||||
sendline("begin; sleep 200 &; sleep 400 &; end")
|
||||
expect_str("pipestatus:0|1|0, generation:%d, command:begin; sleep 200 &; sleep 400 &; end" % generation)
|
||||
expect_str(
|
||||
"pipestatus:0|1|0, generation:%d, command:begin; sleep 200 &; sleep 400 &; end"
|
||||
% generation
|
||||
)
|
||||
expect_prompt()
|
||||
|
||||
# Or a combination of begin/end block and backgrounded job.
|
||||
sendline("begin; sleep 200 &; end; sleep 400 &")
|
||||
expect_str("pipestatus:0|1|0, generation:%d, command:begin; sleep 200 &; end; sleep 400 &" % generation)
|
||||
expect_str(
|
||||
"pipestatus:0|1|0, generation:%d, command:begin; sleep 200 &; end; sleep 400 &"
|
||||
% generation
|
||||
)
|
||||
expect_prompt()
|
||||
|
||||
# Or a combination with variable assignments
|
||||
sendline("begin; set foo bar; sleep 1000 &; end; set bar baz; sleep 2000 &")
|
||||
expect_str("pipestatus:0|1|0, generation:%d, command:begin; set foo bar; sleep 1000 &; end; set bar baz; sleep 2000 &" % generation)
|
||||
expect_str(
|
||||
"pipestatus:0|1|0, generation:%d, command:begin; set foo bar; sleep 1000 &; end; set bar baz; sleep 2000 &"
|
||||
% generation
|
||||
)
|
||||
expect_prompt()
|
||||
|
||||
@@ -41,7 +41,7 @@ expect_str("\x1b[33myellow")
|
||||
expect_str("normal")
|
||||
expect_prompt()
|
||||
|
||||
sendline ("set_color --background blue --print-colors")
|
||||
sendline("set_color --background blue --print-colors")
|
||||
expect_str("black")
|
||||
expect_str("blue")
|
||||
expect_str("brblack")
|
||||
@@ -60,4 +60,3 @@ expect_str("white")
|
||||
expect_str("yellow")
|
||||
expect_str("normal")
|
||||
expect_prompt()
|
||||
|
||||
|
||||
@@ -8,7 +8,9 @@ expect_prompt()
|
||||
sendline("status job-control full")
|
||||
expect_prompt()
|
||||
|
||||
sendline("$fish -c 'status job-control full ; $fish_test_helper report_foreground' &; wait")
|
||||
sendline(
|
||||
"$fish -c 'status job-control full ; $fish_test_helper report_foreground' &; wait"
|
||||
)
|
||||
expect_prompt()
|
||||
|
||||
sendline("echo it worked")
|
||||
|
||||
Reference in New Issue
Block a user