mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-25 09:39:52 +08:00
a16abf22d9
Another from the "why are we asserting instead of doing something sensible" department. The alternative is to make exit() and return() compute their own exit code, but tbh I don't want any *other* builtin to hit this either? Fixes #9659
48 lines
1.1 KiB
Fish
48 lines
1.1 KiB
Fish
# RUN: %fish -C 'set -g fish %fish' %s
|
|
|
|
# Empty commands should be 123
|
|
set empty_var
|
|
$empty_var
|
|
echo $status
|
|
# CHECK: 123
|
|
# CHECKERR: {{.*}} The expanded command was empty.
|
|
# CHECKERR: $empty_var
|
|
# CHECKERR: ^~~~~~~~~^
|
|
|
|
# Failed expansions
|
|
echo "$abc["
|
|
echo $status
|
|
# CHECK: 121
|
|
# CHECKERR: {{.*}} Invalid index value
|
|
# CHECKERR: echo "$abc["
|
|
# CHECKERR: ^
|
|
|
|
# Failed wildcards
|
|
echo *gibberishgibberishgibberish*
|
|
echo $status
|
|
# CHECK: 124
|
|
# CHECKERR: {{.*}} No matches for wildcard '*gibberishgibberishgibberish*'. {{.*}}
|
|
# CHECKERR: echo *gibberishgibberishgibberish*
|
|
# CHECKERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~^
|
|
|
|
$fish -c 'exit -5'
|
|
# CHECKERR: warning: builtin exit returned invalid exit code 251
|
|
echo $status
|
|
# CHECK: 251
|
|
|
|
$fish -c 'exit -1'
|
|
# CHECKERR: warning: builtin exit returned invalid exit code 255
|
|
echo $status
|
|
# CHECK: 255
|
|
|
|
# (we avoid 0, so this is turned into 255 again)
|
|
$fish -c 'exit -256'
|
|
# CHECKERR: warning: builtin exit returned invalid exit code 255
|
|
echo $status
|
|
# CHECK: 255
|
|
|
|
$fish -c 'exit -512'
|
|
# CHECKERR: warning: builtin exit returned invalid exit code 255
|
|
echo $status
|
|
# CHECK: 255
|