mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-24 21:54:26 +08:00
4b921cbc08
This skipped printing a "^" line if the start or length of the error was longer than the source. That seems like the correc thing at first glance, however it means that the caret line isn't skipped *if the file goes on*. So, for example ```fish echo "$abc[" ``` by itself, in a file or via `fish -c`, would not print an error, but ```fish echo "$abc[" true ``` would. That's not a great way to print errors. So instead we just.. imagine the start was at most at the end. The underlying issue why `echo "$abc["` causes this is that `wcstol` didn't move the end pointer for the index value (because there is no number there). I'd fix this, but apparently some of our recursive variable calls absolutely rely on this position value.
27 lines
603 B
Fish
27 lines
603 B
Fish
# RUN: %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: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~^
|