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

View file

@ -9,7 +9,7 @@ begin
# CHECKERR: fish: Unknown command: syntax-error # CHECKERR: fish: Unknown command: syntax-error
# CHECKERR: ~//fish/config.fish (line {{\d+}}): # CHECKERR: ~//fish/config.fish (line {{\d+}}):
# CHECKERR: syntax-error # CHECKERR: syntax-error
# CHECKERR: ^ # CHECKERR: ^~~~~~~~~~~^
# CHECKERR: from sourcing file ~//fish/config.fish # CHECKERR: from sourcing file ~//fish/config.fish
# CHECKERR: called during startup # 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: {{.*}}: Too much data emitted by command substitution so it was discarded
#CHECKERR: set b (string repeat -n 512 x) #CHECKERR: set b (string repeat -n 512 x)
#CHECKERR: ^ #CHECKERR: ^~~~~~~~~~~~~~~~~~~~~~~^
# Command sub over the limit should fail # Command sub over the limit should fail
@ -53,7 +53,7 @@ set --show c
#CHECK: $c[1]: || #CHECK: $c[1]: ||
#CHECKERR: {{.*}}: Too much data emitted by command substitution so it was discarded #CHECKERR: {{.*}}: Too much data emitted by command substitution so it was discarded
#CHECKERR: set -l x (string repeat -n $argv x) #CHECKERR: set -l x (string repeat -n $argv x)
#CHECKERR: ^ #CHECKERR: ^~~~~~~~~~~~~~~~~~~~~~~~~^
#CHECKERR: in function 'subme' with arguments '513' #CHECKERR: in function 'subme' with arguments '513'
#CHECKERR: called on line {{.*}} #CHECKERR: called on line {{.*}}
#CHECKERR: in command substitution #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: {{.*}}: 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: echo this will fail (string repeat --max 513 b) to output anything
#CHECKERR: ^ #CHECKERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~^
# Check that it's reset to the default when unset # Check that it's reset to the default when unset
@ -80,7 +80,7 @@ begin
echo (string repeat -n 10 a) echo (string repeat -n 10 a)
# CHECKERR: {{.*}}cmdsub-limit.fish (line {{\d+}}): Too much data emitted by command substitution so it was discarded # 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: echo (string repeat -n 10 a)
# CHECKERR: ^ # CHECKERR: ^~~~~~~~~~~~~~~~~~~~~~^
end end
echo (string repeat -n 10 a) echo (string repeat -n 10 a)
# CHECK: aaaaaaaaaa # CHECK: aaaaaaaaaa

View file

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

View file

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

View file

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

View file

@ -23,4 +23,4 @@ echo $status
# CHECK: 124 # CHECK: 124
# CHECKERR: {{.*}} No matches for wildcard '*gibberishgibberishgibberish*'. {{.*}} # CHECKERR: {{.*}} No matches for wildcard '*gibberishgibberishgibberish*'. {{.*}}
# CHECKERR: echo *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: {{.*/?}}switch.fish (line {{\d+}}): switch: Expected at most one argument, got 3
#CHECKERR: #CHECKERR:
#CHECKERR: switch (echo; echo; echo) #CHECKERR: switch (echo; echo; echo)
#CHECKERR: ^ #CHECKERR: ^~~~~~~~~~~~~~~~~^
# As is no argument at all. # 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. # 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: fish: 'case' builtin not inside of switch block
#CHECKERR: case a #CHECKERR: case a
#CHECKERR: ^ #CHECKERR: ^~~^
set smurf green set smurf green
@ -90,7 +90,7 @@ switch $smurf
end end
#CHECKERR: {{.*}}switch.fish (line {{\d+}}): No matches for wildcard '*ee*'. See `help wildcards-globbing`. #CHECKERR: {{.*}}switch.fish (line {{\d+}}): No matches for wildcard '*ee*'. See `help wildcards-globbing`.
#CHECKERR: case *ee* #CHECKERR: case *ee*
#CHECKERR: ^ #CHECKERR: ^~~^
#CHECK: Test 2 pass #CHECK: Test 2 pass
switch $smurf switch $smurf
@ -110,10 +110,10 @@ begin
# CHECKERR: fish: Unknown command: doesnotexist # CHECKERR: fish: Unknown command: doesnotexist
# CHECKERR: checks/switch.fish (line {{\d+}}): # CHECKERR: checks/switch.fish (line {{\d+}}):
# CHECKERR: doesnotexist # CHECKERR: doesnotexist
# CHECKERR: ^ # CHECKERR: ^~~~~~~~~~~^
# CHECKERR: in command substitution # CHECKERR: in command substitution
# CHECKERR: {{\t}}called on line {{\d+}} of file checks/switch.fish # CHECKERR: {{\t}}called on line {{\d+}} of file checks/switch.fish
# CHECKERR: checks/switch.fish (line {{\d+}}): Unknown command # CHECKERR: checks/switch.fish (line {{\d+}}): Unknown command
# CHECKERR: switch (doesnotexist) # CHECKERR: switch (doesnotexist)
# CHECKERR: ^ # CHECKERR: ^~~~~~~~~~~~~^
end end

View file

@ -27,7 +27,7 @@ echo '
# CHECK: <fish: Command substitutions not allowed> # CHECK: <fish: Command substitutions not allowed>
# CHECK: <(true one)> # CHECK: <(true one)>
# CHECK: <^> # CHECK: <^~~~~~~~~^>
$fish -c 'echo "unfinished "(subshell' 2>| string replace -r '.*' '<$0>' $fish -c 'echo "unfinished "(subshell' 2>| string replace -r '.*' '<$0>'
# CHECK: <fish: Unexpected end of string, expecting ')'> # 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" $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: ~/temp/this_should_be_an_error.fish (line 1): Missing end to balance this function definition
# CHECKERR: function this_should_be_an_error # CHECKERR: function this_should_be_an_error
# CHECKERR: ^ # CHECKERR: ^~~~~~~^
# CHECKERR: from sourcing file ~/temp/this_should_be_an_error.fish # CHECKERR: from sourcing file ~/temp/this_should_be_an_error.fish
# CHECKERR: source: Error while reading file '{{.*}}/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: Unknown command: this_should_be_an_error
# CHECKERR: fish: # CHECKERR: fish:
# CHECKERR: set -g fish_function_path {{.*}}; this_should_be_an_error # 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&' $fish -c 'time true&'
#CHECKERR: fish: {{.*}} #CHECKERR: fish: {{.*}}
#CHECKERR: time true& #CHECKERR: time true&
#CHECKERR: ^ #CHECKERR: ^~~~~~~~~^
$fish -c 'not time true&' $fish -c 'not time true&'
#CHECKERR: fish: {{.*}} #CHECKERR: fish: {{.*}}