diff options
author | Peter Stephenson <p.w.stephenson@ntlworld.com> | 2022-03-03 19:07:53 +0000 |
---|---|---|
committer | Peter Stephenson <p.w.stephenson@ntlworld.com> | 2022-03-03 19:07:53 +0000 |
commit | 2be2efc122b70a84a9debeaf0a11b99e11df3758 (patch) | |
tree | 2412beb0675084df5364ebab79013c4335b4d218 | |
parent | cb8edf5bd99dbd5299a9a5ebaa24d0cd1c2fd25f (diff) | |
download | zsh-2be2efc122b70a84a9debeaf0a11b99e11df3758.tar.gz zsh-2be2efc122b70a84a9debeaf0a11b99e11df3758.tar.xz zsh-2be2efc122b70a84a9debeaf0a11b99e11df3758.zip |
49787: test for jobs fix in 49783
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | Test/W02jobs.ztst | 2 | ||||
-rw-r--r-- | Test/W03jobparameters.ztst | 49 |
3 files changed, 56 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog index 4fbb3d705..a5ba0fa6a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2022-03-03 Peter Stephenson <p.w.stephenson@ntlworld.com> + + * 49787: Test/W02jobs.ztst, Test/W03jobparameters.ztst: test for + jobs fix in 49783. + 2022-03-01 Peter Stephenson <p.stephenson@samsung.com> * 49783: Src/jobs.c, Src/Modules/parameter.c: Consistently use diff --git a/Test/W02jobs.ztst b/Test/W02jobs.ztst index b09f2ac62..d52888dd9 100644 --- a/Test/W02jobs.ztst +++ b/Test/W02jobs.ztst @@ -144,12 +144,14 @@ zpty_start zpty_input 'sleep 3 &' zpty_input 'jobs -r' + zpty_input '(jobs -r)' zpty_input 'print -- -' zpty_input 'jobs -s' zpty_stop 0:`jobs -r` and `jobs -s` with running job *>\[1] [0-9]## *>\[1] + running*sleep* +*>\[1] + running*sleep* *>- *>zsh:*SIGHUPed* diff --git a/Test/W03jobparameters.ztst b/Test/W03jobparameters.ztst new file mode 100644 index 000000000..474adfaec --- /dev/null +++ b/Test/W03jobparameters.ztst @@ -0,0 +1,49 @@ +# Tests for interactive job control with parameter state + +%prep + + if zmodload zsh/zpty 2> /dev/null; then + zpty_start() { + export PS1= PS2= + zpty -d + zpty zsh "${(q)ZTST_testdir}/../Src/zsh -fiV +Z" + } + zpty_input() { + zpty -w zsh "${(F)@}" $'\n' + } + zpty_line() { + local REPLY + integer i + for (( i = 0; i < ${1:-1}; ++i )); do + zpty -r zsh REPLY + print -r -- ${REPLY%%($'\r\n'|$'\n')} + done + } + zpty_stop() { + # exit twice in case of check_jobs + zpty -w zsh $'exit\nexit\n' + # zpty gives no output when piped without these braces (?) + { zpty -r zsh } | sed $'/[^[:space:]]/!d; s/\r$//;' + zpty -d + : + } + if ! zmodload zsh/parameter 2> /dev/null; then + ZTST_unimplemented='the zsh/parameter module is not available' + fi + else + ZTST_unimplemented='the zsh/zpty module is not available' + fi + +%test + + zpty_start + zpty_input 'sleep 3 &' + zpty_input 'print $jobstates' + zpty_input '(print $jobstates)' + zpty_input 'jobs -s' + zpty_stop +0:$jobstate for running job in main shell and subshell +*>\[1] [0-9]## +*>running:+:*=running +*>running:+:*=running +*>zsh:*SIGHUPed* |