Add acceptable errors to tests

This commit is contained in:
Fabian Boehm 2022-08-11 17:22:03 +02:00
parent 5ef457cfd3
commit 150409eabd
10 changed files with 20 additions and 22 deletions

View file

@ -556,7 +556,7 @@ for PWD in foo bar
end
# CHECKERR: {{.*}}/basic.fish (line {{\d+}}): for: PWD: cannot overwrite read-only variable
# CHECKERR: for PWD in foo bar
# CHECKERR: ^
# CHECKERR: ^~^
# XXX FIXME carat should point at PWD
$fish -c 'echo \xtest'

View file

@ -9,7 +9,7 @@ begin
# CHECKERR: fish: Unknown command: syntax-error
# CHECKERR: ~//fish/config.fish (line {{\d+}}):
# CHECKERR: syntax-error
# CHECKERR: ^
# CHECKERR: ^~~~~~~~~~~^
# CHECKERR: from sourcing file ~//fish/config.fish
# CHECKERR: called during startup

View file

@ -42,7 +42,7 @@ set --show b
#CHECKERR: {{.*}}: Too much data emitted by command substitution so it was discarded
#CHECKERR: set b (string repeat -n 512 x)
#CHECKERR: ^
#CHECKERR: ^~~~~~~~~~~~~~~~~~~~~~~^
# Command sub over the limit should fail
@ -53,7 +53,7 @@ set --show c
#CHECK: $c[1]: ||
#CHECKERR: {{.*}}: Too much data emitted by command substitution so it was discarded
#CHECKERR: set -l x (string repeat -n $argv x)
#CHECKERR: ^
#CHECKERR: ^~~~~~~~~~~~~~~~~~~~~~~~~^
#CHECKERR: in function 'subme' with arguments '513'
#CHECKERR: called on line {{.*}}
#CHECKERR: in command substitution
@ -71,7 +71,7 @@ or echo expected status 122, saw $saved_status >&2
#CHECKERR: {{.*}}: Too much data emitted by command substitution so it was discarded
#CHECKERR: echo this will fail (string repeat --max 513 b) to output anything
#CHECKERR: ^
#CHECKERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~^
# Check that it's reset to the default when unset
@ -80,7 +80,7 @@ begin
echo (string repeat -n 10 a)
# CHECKERR: {{.*}}cmdsub-limit.fish (line {{\d+}}): Too much data emitted by command substitution so it was discarded
# CHECKERR: echo (string repeat -n 10 a)
# CHECKERR: ^
# CHECKERR: ^~~~~~~~~~~~~~~~~~~~~~^
end
echo (string repeat -n 10 a)
# CHECK: aaaaaaaaaa

View file

@ -109,8 +109,7 @@ for status in a b c
end
#CHECKERR: {{.*}}loops.fish (line {{\d+}}): for: status: cannot overwrite read-only variable
#CHECKERR: for status in a b c
#CHECKERR: ^
# XXX FIXME this should point at `status`
#CHECKERR: ^~~~~^
# "That goes for non-electric ones as well (#5548)"
for hostname in a b c
@ -118,8 +117,7 @@ for hostname in a b c
end
#CHECKERR: {{.*}}loops.fish (line {{\d+}}): for: hostname: cannot overwrite read-only variable
#CHECKERR: for hostname in a b c
#CHECKERR: ^
# XXX FIXME this should point at `for`
#CHECKERR: ^~~~~~~^
# For loop control vars available outside the for block
begin

View file

@ -19,7 +19,7 @@ echo $status
echo "begin; echo oops" | $fish -n
#CHECKERR: fish: Missing end to balance this begin
#CHECKERR: begin; echo oops
#CHECKERR: ^
#CHECKERR: ^~~~^
echo $status
#CHECK: 127

View file

@ -473,7 +473,7 @@ for a,b in y 1 z 3
end
# CHECKERR: {{.*}} for: a,b: invalid variable name. See `help identifiers`
# CHECKERR: for a,b in y 1 z 3
# CHECKERR: ^
# CHECKERR: ^~^
# Global vs Universal Unspecified Scopes
set -U __fish_test_global_vs_universal universal

View file

@ -23,4 +23,4 @@ echo $status
# CHECK: 124
# CHECKERR: {{.*}} No matches for wildcard '*gibberishgibberishgibberish*'. {{.*}}
# CHECKERR: echo *gibberishgibberishgibberish*
# CHECKERR: ^
# CHECKERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~^

View file

@ -50,7 +50,7 @@ end
#CHECKERR: {{.*/?}}switch.fish (line {{\d+}}): switch: Expected at most one argument, got 3
#CHECKERR:
#CHECKERR: switch (echo; echo; echo)
#CHECKERR: ^
#CHECKERR: ^~~~~~~~~~~~~~~~~^
# As is no argument at all.
# Because this is a syntax error, we need to start a sub-fish or we wouldn't execute anything else.
@ -68,7 +68,7 @@ end
'
#CHECKERR: fish: 'case' builtin not inside of switch block
#CHECKERR: case a
#CHECKERR: ^
#CHECKERR: ^~~^
set smurf green
@ -90,7 +90,7 @@ switch $smurf
end
#CHECKERR: {{.*}}switch.fish (line {{\d+}}): No matches for wildcard '*ee*'. See `help wildcards-globbing`.
#CHECKERR: case *ee*
#CHECKERR: ^
#CHECKERR: ^~~^
#CHECK: Test 2 pass
switch $smurf
@ -110,10 +110,10 @@ begin
# CHECKERR: fish: Unknown command: doesnotexist
# CHECKERR: checks/switch.fish (line {{\d+}}):
# CHECKERR: doesnotexist
# CHECKERR: ^
# CHECKERR: ^~~~~~~~~~~^
# CHECKERR: in command substitution
# CHECKERR: {{\t}}called on line {{\d+}} of file checks/switch.fish
# CHECKERR: checks/switch.fish (line {{\d+}}): Unknown command
# CHECKERR: switch (doesnotexist)
# CHECKERR: ^
# CHECKERR: ^~~~~~~~~~~~~^
end

View file

@ -27,7 +27,7 @@ echo '
# CHECK: <fish: Command substitutions not allowed>
# CHECK: <(true one)>
# CHECK: <^>
# CHECK: <^~~~~~~~~^>
$fish -c 'echo "unfinished "(subshell' 2>| string replace -r '.*' '<$0>'
# CHECK: <fish: Unexpected end of string, expecting ')'>
@ -48,10 +48,10 @@ 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
# CHECKERR: ^
# CHECKERR: ^~~~~~~^
# 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
# CHECKERR: fish:
# CHECKERR: set -g fish_function_path {{.*}}; this_should_be_an_error
# CHECKERR: ^
# CHECKERR: ^~~~~~~~~~~~~~~~~~~~~~^

View file

@ -41,7 +41,7 @@ not time true
$fish -c 'time true&'
#CHECKERR: fish: {{.*}}
#CHECKERR: time true&
#CHECKERR: ^
#CHECKERR: ^~~~~~~~~^
$fish -c 'not time true&'
#CHECKERR: fish: {{.*}}