2024-04-12 18:19:32 +08:00
|
|
|
#RUN: %fish -C 'set -g fish %fish' %s
|
2021-09-28 23:15:33 +08:00
|
|
|
|
|
|
|
# A $status used as a command should not impact the location of other errors.
|
|
|
|
echo 'echo foo | exec grep # this exec is not allowed!
|
|
|
|
|
|
|
|
$status
|
|
|
|
|
|
|
|
# The error might be found here!' | $fish 2>| string replace -r '(.*)' '<$1>'
|
|
|
|
|
|
|
|
# CHECK: <fish: The 'exec' command can not be used in a pipeline>
|
|
|
|
# CHECK: <echo foo | exec grep # this exec is not allowed!>
|
2022-08-12 22:53:31 +08:00
|
|
|
# CHECK: < ^~~~~~~~^>
|
2021-09-28 23:59:59 +08:00
|
|
|
|
2022-04-01 07:14:59 +08:00
|
|
|
echo 'true | time false' | $fish 2>| string replace -r '(.*)' '<$1>'
|
|
|
|
# CHECK: <fish: The 'time' command may only be at the beginning of a pipeline>
|
|
|
|
# CHECK: <true | time false>
|
2022-08-12 22:53:31 +08:00
|
|
|
# CHECK: < ^~~~~~~~~^>
|
2022-04-01 07:14:59 +08:00
|
|
|
|
|
|
|
|
2021-09-28 23:59:59 +08:00
|
|
|
echo '
|
|
|
|
|
2022-10-27 10:50:46 +08:00
|
|
|
FOO=BAR (true one)
|
2021-09-28 23:59:59 +08:00
|
|
|
(true two)
|
|
|
|
|
|
|
|
# more things
|
|
|
|
' | $fish 2>| string replace -r '(.*)' '<$1>'
|
|
|
|
|
2023-11-18 19:24:58 +08:00
|
|
|
# CHECK: <fish: command substitutions not allowed in command position. Try var=(your-cmd) $var ...>
|
2022-10-27 10:50:46 +08:00
|
|
|
# CHECK: <FOO=BAR (true one)>
|
|
|
|
# CHECK: < ^~~~~~~~~^>
|
2021-12-04 21:41:54 +08:00
|
|
|
|
|
|
|
$fish -c 'echo "unfinished "(subshell' 2>| string replace -r '.*' '<$0>'
|
|
|
|
# CHECK: <fish: Unexpected end of string, expecting ')'>
|
|
|
|
# CHECK: <echo "unfinished "(subshell>
|
|
|
|
# CHECK: < ^>
|
|
|
|
|
|
|
|
$fish -c 'echo "unfinished "$(subshell' 2>| string replace -r '.*' '<$0>'
|
|
|
|
# CHECK: <fish: Unexpected end of string, expecting ')'>
|
|
|
|
# CHECK: <echo "unfinished "$(subshell>
|
|
|
|
# CHECK: < ^>
|
2022-03-24 00:33:24 +08:00
|
|
|
|
2022-04-03 22:29:13 +08:00
|
|
|
$fish -c 'echo "ok $(echo still ok)syntax error: \x"' 2>| string replace -r '.*' '<$0>'
|
|
|
|
# CHECK: <fish: Invalid token '"ok $(echo still ok)syntax error: \x"'>
|
|
|
|
# CHECK: <echo "ok $(echo still ok)syntax error: \x">
|
2022-08-12 22:53:31 +08:00
|
|
|
# CHECK: < ^~~~~~~~~~~~~~~~^>
|
2022-04-03 22:29:13 +08:00
|
|
|
|
2022-07-24 23:51:26 +08:00
|
|
|
echo "function this_should_be_an_error" >$TMPDIR/this_should_be_an_error.fish
|
|
|
|
$fish -c "set -g fish_function_path $(string escape $TMPDIR); this_should_be_an_error"
|
|
|
|
# CHECKERR: ~/temp/this_should_be_an_error.fish (line 1): Missing end to balance this function definition
|
|
|
|
# CHECKERR: function this_should_be_an_error
|
2022-08-11 23:22:03 +08:00
|
|
|
# CHECKERR: ^~~~~~~^
|
2022-07-24 23:51:26 +08:00
|
|
|
# CHECKERR: from sourcing file ~/temp/this_should_be_an_error.fish
|
|
|
|
# CHECKERR: source: Error while reading file '{{.*}}/this_should_be_an_error.fish'
|
|
|
|
# CHECKERR: fish: Unknown command: this_should_be_an_error
|
2022-04-03 22:29:13 +08:00
|
|
|
# CHECKERR: fish:
|
2022-07-24 23:51:26 +08:00
|
|
|
# CHECKERR: set -g fish_function_path {{.*}}; this_should_be_an_error
|
2022-08-11 23:22:03 +08:00
|
|
|
# CHECKERR: ^~~~~~~~~~~~~~~~~~~~~~^
|
2022-11-16 02:02:30 +08:00
|
|
|
|
|
|
|
$fish -c 'echo {$}'
|
2022-11-16 02:03:06 +08:00
|
|
|
# CHECKERR: fish: Expected a variable name after this $.
|
2022-11-16 02:02:30 +08:00
|
|
|
# CHECKERR: echo {$}
|
|
|
|
# CHECKERR: ^
|
|
|
|
|
|
|
|
$fish -c 'echo {$,}'
|
|
|
|
# CHECKERR: fish: Expected a variable name after this $.
|
|
|
|
# CHECKERR: echo {$,}
|
|
|
|
# CHECKERR: ^
|
2022-12-23 00:23:42 +08:00
|
|
|
|
|
|
|
echo "bind -M" | $fish
|
|
|
|
# CHECKERR: bind: -M: option requires an argument
|
2024-05-03 15:31:55 +08:00
|
|
|
# CHECKERR: Standard input (line 1):
|
2022-12-23 00:23:42 +08:00
|
|
|
# CHECKERR: bind -M
|
|
|
|
# CHECKERR: ^
|
2022-12-23 00:34:10 +08:00
|
|
|
# CHECKERR: (Type 'help bind' for related documentation)
|
2022-12-23 00:23:42 +08:00
|
|
|
|
2023-09-19 23:34:13 +08:00
|
|
|
$fish -c 'if -e; end'
|
|
|
|
# CHECKERR: fish: Unknown command: -e
|
|
|
|
# CHECKERR: fish:
|
|
|
|
# CHECKERR: if -e; end
|
|
|
|
# CHECKERR: ^^
|
|
|
|
|
|
|
|
$fish -c 'begin --notanoption; end'
|
|
|
|
# CHECKERR: fish: Unknown command: --notanoption
|
|
|
|
# CHECKERR: fish:
|
|
|
|
# CHECKERR: begin --notanoption; end
|
|
|
|
# CHECKERR: ^~~~~~~~~~~~^
|
|
|
|
|
|
|
|
$fish -c 'begin --help'
|
|
|
|
# CHECKERR: fish: begin: missing man page
|
|
|
|
# CHECKERR: Documentation may not be installed.
|
|
|
|
# CHECKERR: `help begin` will show an online version
|
2023-10-13 22:27:35 +08:00
|
|
|
|
|
|
|
$fish -c 'echo (for status in foo; end)'
|
|
|
|
# CHECKERR: fish: for: status: cannot overwrite read-only variable
|
|
|
|
# CHECKERR: for status in foo; end
|
|
|
|
# CHECKERR: ^~~~~^
|
|
|
|
# CHECKERR: in command substitution
|
|
|
|
# CHECKERR: fish: Invalid arguments
|
|
|
|
# CHECKERR: echo (for status in foo; end)
|
|
|
|
# CHECKERR: ^~~~~~~~~~~~~~~~~~~~~~~^
|
|
|
|
|
|
|
|
$fish -c 'echo (echo <&foo)'
|
|
|
|
# CHECKERR: fish: Requested redirection to 'foo', which is not a valid file descriptor
|
|
|
|
# CHECKERR: echo <&foo
|
|
|
|
# CHECKERR: ^~~~^
|
|
|
|
# CHECKERR: in command substitution
|
|
|
|
# CHECKERR: fish: Invalid arguments
|
|
|
|
# CHECKERR: echo (echo <&foo)
|
|
|
|
# CHECKERR: ^~~~~~~~~~~^
|
|
|
|
|
|
|
|
|
|
|
|
$fish -c 'echo (time echo foo &)'
|
|
|
|
# CHECKERR: fish: 'time' is not supported for background jobs. Consider using 'command time'.
|
|
|
|
# CHECKERR: time echo foo &
|
|
|
|
# CHECKERR: ^~~~~~~~~~~~~~^
|
|
|
|
# CHECKERR: in command substitution
|
|
|
|
# CHECKERR: fish: Invalid arguments
|
|
|
|
# CHECKERR: echo (time echo foo &)
|
|
|
|
# CHECKERR: ^~~~~~~~~~~~~~~~^
|
|
|
|
|
2024-05-03 15:31:55 +08:00
|
|
|
$fish -c 'time begin; end &'
|
|
|
|
# CHECKERR: fish: 'time' is not supported for background jobs. Consider using 'command time'.
|
|
|
|
# CHECKERR: time begin; end &
|
|
|
|
# CHECKERR: ^~~~~~~~~~~~~~~~^
|
|
|
|
|
2023-10-13 22:27:35 +08:00
|
|
|
$fish -c 'echo (set -l foo 1 2 3; for $foo in foo; end)'
|
|
|
|
# CHECKERR: fish: Unable to expand variable name ''
|
|
|
|
# CHECKERR: set -l foo 1 2 3; for $foo in foo; end
|
|
|
|
# CHECKERR: ^~~^
|
|
|
|
# CHECKERR: in command substitution
|
|
|
|
# CHECKERR: fish: Expansion error
|
|
|
|
# CHECKERR: echo (set -l foo 1 2 3; for $foo in foo; end)
|
|
|
|
# CHECKERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
|
|
|
|
|
|
|
|
$fish -c 'echo (echo *nosuchname*)'
|
|
|
|
# CHECKERR: fish: No matches for wildcard '*nosuchname*'. See `help wildcards-globbing`.
|
|
|
|
# CHECKERR: echo *nosuchname*
|
|
|
|
# CHECKERR: ^~~~~~~~~~~^
|
|
|
|
# CHECKERR: in command substitution
|
|
|
|
# CHECKERR: fish: Unmatched wildcard
|
|
|
|
# CHECKERR: echo (echo *nosuchname*)
|
|
|
|
# CHECKERR: ^~~~~~~~~~~~~~~~~~^
|