fork/fish-shell

git clone https://git.julia.blue/fork/fish-shell

NahorAdd tests to exercise all builtin error messages99d63c21f

master
1.9 KiB87 linesraw
1# RUN: env fish_test_helper=%fish_test_helper fish=%fish %fish %s
2#REQUIRES: command -v %fish_test_helper
3
4$fish -c 'function main; exit 4; true; end; main'
5echo $status
6#CHECK: 4
7
8$fish -c 'begin; exit 5; true; end'
9echo $status
10#CHECK: 5
11
12$fish -c 'kill -SIGHUP $fish_pid'
13echo $status
14#CHECK: 129
15
16$fish -c 'function main; kill -SIGTERM $fish_pid; true; end; main'
17echo $status
18#CHECK: 143
19
20function alarm --on-signal ALRM
21    echo ALRM received
22end
23
24kill -s ALRM $fish_pid
25# CHECK: ALRM received
26
27function anychild --on-process-exit 0
28    # Type and exit status
29    echo $argv[1] $argv[3]
30end
31
32function anyjob --on-job-exit 0
33    # Type and exit status
34    echo $argv[1] $argv[3]
35end
36
37echo "command false:"
38command false
39# CHECK: command false:
40# (Solaris' false exits with 255, not 1)
41# CHECK: PROCESS_EXIT {{1|255}}
42# CHECK: JOB_EXIT 0
43
44echo "command true:"
45command true
46# CHECK: command true:
47# CHECK: PROCESS_EXIT 0
48# CHECK: JOB_EXIT 0
49
50echo "command false | true:"
51command false | command true
52# CHECK: command false | true:
53# CHECK: PROCESS_EXIT {{1|255}}
54# CHECK: PROCESS_EXIT 0
55# CHECK: JOB_EXIT 0
56
57# Signals are reported correctly.
58# SIGKILL $status is 128 + 9 = 137
59$fish_test_helper sigkill_self
60# CHECK: PROCESS_EXIT 137
61# CHECK: JOB_EXIT 0
62
63function test_blocks
64    block -l
65    command echo "This is the process whose exit event should be blocked"
66    echo "This should come before the event handler"
67end
68test_blocks
69# CHECK: This is the process whose exit event should be blocked
70# CHECK: This should come before the event handler
71
72echo "Now event handler should have run"
73# CHECK: PROCESS_EXIT 0
74# CHECK: JOB_EXIT 0
75# CHECK: Now event handler should have run
76
77begin
78    block --erase --local
79    # CHECKERR: block: Can not specify scope when removing block
80    block --erase --global
81    # CHECKERR: block: Can not specify scope when removing block
82    block --erase
83    # CHECKERR: block: No blocks defined
84end
85
86exit 0
87# CHECK: PROCESS_EXIT 0