26763: fix problem on failed cd -s to relative path
[zsh.git] / Misc / job-control-tests
blobecb9a7694cc2d2405987cca2ee16ad61633791ad
1 # These are some tests for the job control code.  The code chunks
2 # have to be run interactively.  Some use files in the zsh distribution.
4 # Try
5 #   ^Z
6 #   fg
7 if true; then cat Src/builtin.c | less; fi
9 # Try
10 #   ^Z
11 #   fg
12 fn() {
13   if true; then cat Src/builtin.c | less; fi
17 # Try
18 #   ^Z
19 #   fg
20 #   ^C
21 # then
22 #   ^Z
23 #   bg
24 #   kill
25 while true; do sed -e 's/foo/bar/' Src/builtin.c >/dev/null; done
27 # Try
28 #   ^C
29 # ignoring the error messages from sed.
30 # ^Z is more of a problem since you have to catch the sed.
31 while true; do sed -e 's/foo/bar/' non-existent-file >/dev/null; done
33 # Try
34 #   ^Z
35 #   fg
36 #   ^Z
37 #   fg
38 fn() {
39   local a
40   while read a; do :; done
41   less "$@"
43 cat foo | fn bar
45 # Try
46 #   ^Z
47 #   fg
48 fn() {
49   cat builtin.c
51 fn | while read a; do :; done
53 # Try
54 #   ^Z
55 #   fg
56 #   q
57 #   ^Z
58 #   fg
59 #   q
60 fn() {
61   less builtin.c
62   echo done
64 x=2; while (( x-- )); do f; done
66 # Try
67 #   ^C
68 # This won't work because zcat doesn't tell us that it received a signal.
69 # But
70 #   ^Z
71 #   fg
72 #   ^C (probably a second ^C is needed: if the continued zcat is still running)
73 # works.
74 # (See also the file Etc/BUGS)
75 while true; do zcat foo.gz > /dev/null; done