fish-shell/tests/job_summary.expect

40 lines
1 KiB
Text
Raw Normal View History

# vim: set filetype=expect:
#
# Test job summary for interactive shells.
set pid [spawn $fish]
expect_prompt
send_line "function fish_job_summary; string join ':' \$argv; end"
expect_prompt
# fish_job_summary is called when background job ends.
send_line "sleep 0.5 &"
sleep 0.050
expect_prompt
sleep 0.550
expect -re "\[0-9]+:0:sleep 0.5 &:ENDED"
send_line ""
expect_prompt
# fish_job_summary is called when background job is signalled.
# cmd_line correctly prints only the actually backgrounded job.
send_line "false; sleep 10 &; true"
sleep 0.100
expect_prompt
exec -- pkill -TERM sleep -P $pid
sleep 0.100
expect -re "\[0-9]+:0:sleep 10 &:SIGTERM:Polite quit request"
send_line ""
expect_prompt
# fish_job_summary is called when foreground job is signalled.
# cmd_line contains the entire pipeline. proc_id and proc_name are set in a pipeline.
send_line "true | sleep 6"
sleep 0.100
exec -- pkill -KILL sleep -P $pid
sleep 0.100
expect -re "\[0-9]+:1:true|sleep 6:SIGKILL:Forced quit:\[0-9]+:sleep"
send_line ""
expect_prompt