From 150409eabd1a8bff644099911e25f04fe3862936 Mon Sep 17 00:00:00 2001 From: Fabian Boehm Date: Thu, 11 Aug 2022 17:22:03 +0200 Subject: [PATCH] Add acceptable errors to tests --- tests/checks/basic.fish | 2 +- tests/checks/broken-config.fish | 2 +- tests/checks/cmdsub-limit.fish | 8 ++++---- tests/checks/loops.fish | 6 ++---- tests/checks/no-execute.fish | 2 +- tests/checks/set.fish | 2 +- tests/checks/status-value.fish | 2 +- tests/checks/switch.fish | 10 +++++----- tests/checks/syntax-error-location.fish | 6 +++--- tests/checks/time.fish | 2 +- 10 files changed, 20 insertions(+), 22 deletions(-) diff --git a/tests/checks/basic.fish b/tests/checks/basic.fish index cfade8f88..acb631c8b 100644 --- a/tests/checks/basic.fish +++ b/tests/checks/basic.fish @@ -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' diff --git a/tests/checks/broken-config.fish b/tests/checks/broken-config.fish index 377b23929..35fb15cf9 100644 --- a/tests/checks/broken-config.fish +++ b/tests/checks/broken-config.fish @@ -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 diff --git a/tests/checks/cmdsub-limit.fish b/tests/checks/cmdsub-limit.fish index 81dee3894..ab3ee9bbf 100644 --- a/tests/checks/cmdsub-limit.fish +++ b/tests/checks/cmdsub-limit.fish @@ -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 diff --git a/tests/checks/loops.fish b/tests/checks/loops.fish index 26ca0e5b1..aea9d7e3a 100644 --- a/tests/checks/loops.fish +++ b/tests/checks/loops.fish @@ -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 diff --git a/tests/checks/no-execute.fish b/tests/checks/no-execute.fish index 5bb4d11eb..93241c58a 100644 --- a/tests/checks/no-execute.fish +++ b/tests/checks/no-execute.fish @@ -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 diff --git a/tests/checks/set.fish b/tests/checks/set.fish index 9b290da4d..4fd30e19b 100644 --- a/tests/checks/set.fish +++ b/tests/checks/set.fish @@ -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 diff --git a/tests/checks/status-value.fish b/tests/checks/status-value.fish index 7ca2ac73d..a0f65f3cc 100644 --- a/tests/checks/status-value.fish +++ b/tests/checks/status-value.fish @@ -23,4 +23,4 @@ echo $status # CHECK: 124 # CHECKERR: {{.*}} No matches for wildcard '*gibberishgibberishgibberish*'. {{.*}} # CHECKERR: echo *gibberishgibberishgibberish* -# CHECKERR: ^ +# CHECKERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~^ diff --git a/tests/checks/switch.fish b/tests/checks/switch.fish index 53bbf222c..b5393c30e 100644 --- a/tests/checks/switch.fish +++ b/tests/checks/switch.fish @@ -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 diff --git a/tests/checks/syntax-error-location.fish b/tests/checks/syntax-error-location.fish index 47fbf886a..78abdcbed 100644 --- a/tests/checks/syntax-error-location.fish +++ b/tests/checks/syntax-error-location.fish @@ -27,7 +27,7 @@ echo ' # CHECK: # CHECK: <(true one)> -# CHECK: <^> +# CHECK: <^~~~~~~~~^> $fish -c 'echo "unfinished "(subshell' 2>| string replace -r '.*' '<$0>' # CHECK: @@ -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: ^~~~~~~~~~~~~~~~~~~~~~^ diff --git a/tests/checks/time.fish b/tests/checks/time.fish index 0eb469be7..a8795423f 100644 --- a/tests/checks/time.fish +++ b/tests/checks/time.fish @@ -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: {{.*}}