Update tests for changed error output

This commit is contained in:
Aaron Gyes 2021-11-03 22:52:17 -07:00
parent 72c04d11ad
commit fefb913857
19 changed files with 107 additions and 102 deletions

View file

@ -8,7 +8,7 @@ function __fish_unexpected_hist_args --no-scope-shadowing
return 0 return 0
end end
if set -q argv[1] if set -q argv[1]
printf (_ "%ls: %ls: expected %d arguments; got %d") $cmd $hist_cmd 0 (count $argv) >&2 printf (_ "%ls: %ls: expected %d arguments; got %d\n") $cmd $hist_cmd 0 (count $argv) >&2
return 0 return 0
end end
return 1 return 1

View file

@ -113,34 +113,40 @@ echo comment after conjunction
# --help works # --help works
builtin and --help >/dev/null builtin and --help >/dev/null
# CHECKERR: fish: Missing man page {{.*}} # CHECKERR: fish: and: missing man page
# CHECKERR: `help '{{.*}}'` will open the online version. # CHECKERR: Documentation may not be installed.
# CHECKERR: `help and` will show an online version
echo $status echo $status
and --help >/dev/null and --help >/dev/null
# CHECKERR: fish: Missing man page {{.*}} # CHECKERR: fish: and: missing man page
# CHECKERR: `help '{{.*}}'` will open the online version. # CHECKERR: Documentation may not be installed.
# CHECKERR: `help and` will show an online version
echo $status echo $status
# CHECK: 0 # CHECK: 0
# CHECK: 0 # CHECK: 0
builtin or --help >/dev/null builtin or --help >/dev/null
# CHECKERR: fish: Missing man page {{.*}} # CHECKERR: fish: or: missing man page
# CHECKERR: `help '{{.*}}'` will open the online version. # CHECKERR: Documentation may not be installed.
# CHECKERR: `help or` will show an online version
echo $status echo $status
or --help >/dev/null or --help >/dev/null
# CHECKERR: fish: Missing man page {{.*}} # CHECKERR: fish: or: missing man page
# CHECKERR: `help '{{.*}}'` will open the online version. # CHECKERR: Documentation may not be installed.
# CHECKERR: `help or` will show an online version
echo $status echo $status
# CHECK: 0 # CHECK: 0
# CHECK: 0 # CHECK: 0
builtin not --help >/dev/null builtin not --help >/dev/null
# CHECKERR: fish: Missing man page {{.*}} # CHECKERR: fish: not: missing man page
# CHECKERR: `help '{{.*}}'` will open the online version. # CHECKERR: Documentation may not be installed.
# CHECKERR: `help not` will show an online version
echo $status echo $status
not --help >/dev/null not --help >/dev/null
# CHECKERR: fish: Missing man page {{.*}} # CHECKERR: fish: not: missing man page
# CHECKERR: `help '{{.*}}'` will open the online version. # CHECKERR: Documentation may not be installed.
# CHECKERR: `help not` will show an online version
echo $status echo $status
# CHECK: 0 # CHECK: 0
# CHECK: 0 # CHECK: 0

View file

@ -66,16 +66,16 @@ argparse h-help=x
# --max-args and --min-args work # --max-args and --min-args work
begin begin
argparse --name min-max --min-args 1 h/help -- argparse --name min-max --min-args 1 h/help --
#CHECKERR: min-max: Expected at least 1 args, got 0 #CHECKERR: min-max: expected >= 1 arguments; got 0
argparse --name min-max --min-args 1 --max-args 3 h/help -- arg1 argparse --name min-max --min-args 1 --max-args 3 h/help -- arg1
argparse --name min-max --min-args 1 --max-args 3 h/help -- arg1 arg2 argparse --name min-max --min-args 1 --max-args 3 h/help -- arg1 arg2
argparse --name min-max --min-args 1 --max-args 3 h/help -- --help arg1 arg2 arg3 argparse --name min-max --min-args 1 --max-args 3 h/help -- --help arg1 arg2 arg3
argparse --name min-max --min-args 1 --max-args 3 h/help -- arg1 arg2 -h arg3 arg4 argparse --name min-max --min-args 1 --max-args 3 h/help -- arg1 arg2 -h arg3 arg4
#CHECKERR: min-max: Expected at most 3 args, got 4 #CHECKERR: min-max: expected <= 3 arguments; got 4
argparse --name min-max --max-args 1 h/help -- argparse --name min-max --max-args 1 h/help --
argparse --name min-max --max-args 1 h/help -- arg1 argparse --name min-max --max-args 1 h/help -- arg1
argparse --name min-max --max-args 1 h/help -- arg1 arg2 argparse --name min-max --max-args 1 h/help -- arg1 arg2
#CHECKERR: min-max: Expected at most 1 args, got 2 #CHECKERR: min-max: expected <= 1 arguments; got 2
end end
# Invalid \"#-val\" spec # Invalid \"#-val\" spec
@ -91,7 +91,7 @@ end
# Invalid arg in the face of a \"#-val\" spec # Invalid arg in the face of a \"#-val\" spec
begin begin
argparse '#-val' -- abc -x def argparse '#-val' -- abc -x def
# CHECKERR: argparse: Unknown option '-x' # CHECKERR: argparse: -x: unknown option
end end
# Defining a short flag more than once # Defining a short flag more than once
@ -305,7 +305,7 @@ function notargparse
argparse a/alpha -- --banana argparse a/alpha -- --banana
end end
notargparse notargparse
# CHECKERR: notargparse: Unknown option '--banana' # CHECKERR: notargparse: --banana: unknown option
true true
@ -400,10 +400,10 @@ end
# #6483 - error messages for missing arguments # #6483 - error messages for missing arguments
argparse -n foo q r/required= -- foo -qr argparse -n foo q r/required= -- foo -qr
# CHECKERR: foo: Expected argument for option r # CHECKERR: foo: -r: option requires an argument
argparse r/required= -- foo --required argparse r/required= -- foo --required
# CHECKERR: argparse: Expected argument for option --required # CHECKERR: argparse: --required: option requires an argument
### The fish_opt wrapper: ### The fish_opt wrapper:
# No args is an error # No args is an error
@ -422,17 +422,18 @@ and echo unexpected status $status
# A required and optional arg makes no sense # A required and optional arg makes no sense
fish_opt -s h -l help -r --optional-val fish_opt -s h -l help -r --optional-val
and echo unexpected status $status and echo unexpected status $status
#CHECKERR: fish_opt: Mutually exclusive flags 'o/optional-val' and `r/required-val` seen #CHECKERR: fish_opt: o/optional-val r/required-val: options cannot be used together
# XXX FIXME the error should output -r and --optional-val: what the user used
# A repeated and optional arg makes no sense # A repeated and optional arg makes no sense
fish_opt -s h -l help --multiple-vals --optional-val fish_opt -s h -l help --multiple-vals --optional-val
and echo unexpected status $status and echo unexpected status $status
#CHECKERR: fish_opt: Mutually exclusive flags 'multiple-vals' and `o/optional-val` seen #CHECKERR: fish_opt: multiple-vals o/optional-val: options cannot be used together
# An unexpected arg not associated with a flag is an error # An unexpected arg not associated with a flag is an error
fish_opt -s h -l help hello fish_opt -s h -l help hello
and echo unexpected status $status and echo unexpected status $status
#CHECKERR: fish_opt: Expected at most 0 args, got 1 #CHECKERR: fish_opt: expected <= 0 arguments; got 1
# Now verify that valid combinations of options produces the correct output. # Now verify that valid combinations of options produces the correct output.

View file

@ -537,6 +537,7 @@ echo (echo hello\\)
for PWD in foo bar for PWD in foo bar
true true
end end
# CHECKERR: {{.*}}/basic.fish (line {{\d+}}): You cannot use read-only variable 'PWD' in a for loop # 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

View file

@ -5,10 +5,11 @@
# Verify that an invalid bind mode is rejected. >&2 # Verify that an invalid bind mode is rejected. >&2
bind -m 'bad bind mode' \cX true bind -m 'bad bind mode' \cX true
# CHECKERR: bind: mode name 'bad bind mode' is not valid. See `help identifiers`. # CHECKERR: bind: bad bind mode: invalid mode. See `help identifiers`
# Verify that an invalid bind mode target is rejected. >&2 # Verify that an invalid bind mode target is rejected. >&2
bind -M bind-mode \cX true bind -M bind-mode \cX true
# CHECKERR: bind: mode name 'bind-mode' is not valid. See `help identifiers`. # CHECKERR: bind: bind-mode: invalid mode. See `help identifiers`
# CHECKERR: bind: No binding found for sequence '\t' # CHECKERR: bind: No binding found for sequence '\t'
# This should succeed and result in a success, zero, status. # This should succeed and result in a success, zero, status.

View file

@ -6,8 +6,7 @@ builtin -q; and echo None exists
builtin -q string echo banana; and echo Some of these exist builtin -q string echo banana; and echo Some of these exist
#CHECK: Some of these exist #CHECK: Some of these exist
builtin -nq string builtin -nq string
#CHECKERR: builtin: Invalid combination of options, #CHECKERR: builtin: invalid option combination, --query and --names are mutually exclusive
#CHECKERR: --query and --names are mutually exclusive
echo $status echo $status
#CHECK: 2 #CHECK: 2
exit 0 exit 0

View file

@ -371,7 +371,7 @@ complete banana
# "-a" ain't # "-a" ain't
complete banana bar complete banana bar
#CHECKERR: complete: Too many arguments #CHECKERR: complete: too many arguments
#CHECKERR: #CHECKERR:
#CHECKERR: {{.*}}checks/complete.fish (line {{\d+}}): #CHECKERR: {{.*}}checks/complete.fish (line {{\d+}}):
#CHECKERR: complete banana bar #CHECKERR: complete banana bar

View file

@ -60,7 +60,7 @@ function name1 -a arg1 arg2
end end
function -a arg1 arg2 name2 function -a arg1 arg2 name2
end end
#CHECKERR: {{.*}}checks/function.fish (line {{\d+}}): function: Illegal function name '-a' #CHECKERR: {{.*}}checks/function.fish (line {{\d+}}): function: -a: invalid function name
#CHECKERR: function -a arg1 arg2 name2 #CHECKERR: function -a arg1 arg2 name2
#CHECKERR: ^ #CHECKERR: ^
function name3 --argument-names arg1 arg2 function name3 --argument-names arg1 arg2
@ -69,12 +69,12 @@ function name3 --argument-names arg1 arg2
end end
function --argument-names arg1 arg2 name4 function --argument-names arg1 arg2 name4
end end
#CHECKERR: {{.*}}checks/function.fish (line {{\d+}}): function: Illegal function name '--argument-names' #CHECKERR: {{.*}}checks/function.fish (line {{\d+}}): function: --argument-names: invalid function name
#CHECKERR: function --argument-names arg1 arg2 name4 #CHECKERR: function --argument-names arg1 arg2 name4
#CHECKERR: ^ #CHECKERR: ^
function name5 abc --argument-names def function name5 abc --argument-names def
end end
#CHECKERR: {{.*}}checks/function.fish (line {{\d+}}): function: Unexpected positional argument 'abc' #CHECKERR: {{.*}}checks/function.fish (line {{\d+}}): function: abc: unexpected positional argument
#CHECKERR: function name5 abc --argument-names def #CHECKERR: function name5 abc --argument-names def
#CHECKERR: ^ #CHECKERR: ^
functions -q name1; and echo "Function name1 found" functions -q name1; and echo "Function name1 found"
@ -108,7 +108,7 @@ test "$name3[3..-1]" = "$name3a[3..-1]"; and echo "3 = 3a"
function test function test
echo banana echo banana
end end
#CHECKERR: {{.*}}checks/function.fish (line {{\d+}}): function: The name 'test' is reserved, and cannot be used as a function name #CHECKERR: {{.*}}checks/function.fish (line {{\d+}}): function: test: cannot use reserved keyword as function name
#CHECKERR: function test #CHECKERR: function test
#CHECKERR: ^ #CHECKERR: ^

View file

@ -6,10 +6,8 @@ end
# ========== # ==========
# Verify that `functions --details` works as expected when given too many args. # Verify that `functions --details` works as expected when given too many args.
set x (functions --details f1 f2 2>&1) functions --details f1 f2
if test "$x" != "functions --details: Expected 1 args, got 2" #CHECKERR: functions: --details: expected 1 arguments; got 2
echo "Unexpected output for 'functions --details f1 f2': $x" >&2
end
# ========== # ==========
# Verify that `functions --details` works as expected when given the name of a # Verify that `functions --details` works as expected when given the name of a
@ -20,10 +18,8 @@ functions --details f1
# ========== # ==========
# Verify that `functions --details` works as expected when given the name of an # Verify that `functions --details` works as expected when given the name of an
# unknown function. # unknown function.
set x (functions -D f2) functions -D f2
if test "$x" != n/a #CHECK: n/a
echo "Unexpected output for 'functions --details f2': $x" >&2
end
# ========== # ==========
# Verify that `functions --details` works as expected when given the name of a # Verify that `functions --details` works as expected when given the name of a
@ -111,9 +107,10 @@ functions --no-details t
# CHECK: end # CHECK: end
functions --no-details --details t functions --no-details --details t
# CHECKERR: functions: Invalid combination of options # CHECKERR: functions: invalid option combination
# CHECKERR: # CHECKERR:
# CHECKERR: checks/functions.fish (line {{\d+}}): # CHECKERR: checks/functions.fish (line {{\d+}}):
# CHECKERR: functions --no-details --details t # CHECKERR: functions --no-details --details t
# CHECKERR: ^ # CHECKERR: ^
# CHECKERR: (Type 'help functions' for related documentation) # CHECKERR: (Type 'help functions' for related documentation)
# XXX FIXME ^ caret should point at --no-details --details

View file

@ -6,63 +6,62 @@
# First with the history function. # First with the history function.
history --search --merge history --search --merge
#CHECKERR: history: Mutually exclusive flags 'merge' and `search` seen #CHECKERR: history: merge search: options cannot be used together
history --clear --contains history --clear --contains
#CHECKERR: history: you cannot use any options with the clear command #CHECKERR: history: clear: subcommand takes no options
history --merge -t history --merge -t
#CHECKERR: history: you cannot use any options with the merge command #CHECKERR: history: merge: subcommand takes no options
history --save xyz history --save xyz
#CHECKERR: history: save expected 0 args, got 1 #CHECKERR: history: save: expected 0 arguments; got 1
# Now with the history builtin. # Now with the history builtin.
builtin history --save --prefix builtin history --save --prefix
#CHECKERR: history: you cannot use any options with the save command #CHECKERR: history: save: subcommand takes no options
builtin history --clear --show-time builtin history --clear --show-time
#CHECKERR: history: you cannot use any options with the clear command #CHECKERR: history: clear: subcommand takes no options
builtin history --merge xyz builtin history --merge xyz
#CHECKERR: history merge: Expected 0 args, got 1 #CHECKERR: history: merge: expected 0 arguments; got 1
builtin history --clear abc def builtin history --clear abc def
#CHECKERR: history clear: Expected 0 args, got 2 #CHECKERR: history: clear: expected 0 arguments; got 2
# Now using the preferred subcommand form. Note that we support flags before # Now using the preferred subcommand form. Note that we support flags before
# or after the subcommand name so test both variants. # or after the subcommand name so test both variants.
# First with the history function. # First with the history function.
history clear --contains history clear --contains
#CHECKERR: history: you cannot use any options with the clear command #CHECKERR: history: clear: subcommand takes no options
history clear-session --contains history clear-session --contains
#CHECKERR: history: you cannot use any options with the clear-session command #CHECKERR: history: clear-session: subcommand takes no options
history merge -t history merge -t
#CHECKERR: history: you cannot use any options with the merge command #CHECKERR: history: merge: subcommand takes no options
history save xyz history save xyz
#CHECKERR: history: save expected 0 args, got 1 #CHECKERR: history: save: expected 0 arguments; got 1
history --prefix clear history --prefix clear
#CHECKERR: history: you cannot use any options with the clear command #CHECKERR: history: clear: subcommand takes no options
history --prefix clear-session history --prefix clear-session
#CHECKERR: history: you cannot use any options with the clear-session command #CHECKERR: history: clear-session: subcommand takes no options
history --show-time merge history --show-time merge
#CHECKERR: history: you cannot use any options with the merge command #CHECKERR: history: merge: subcommand takes no options
# Now with the history builtin. # Now with the history builtin.
builtin history --search --merge builtin history --search --merge
#CHECKERR: history: Invalid combination of options, #CHECKERR: history: search merge: options cannot be used together
#CHECKERR: you cannot do both 'search' and 'merge' in the same invocation
builtin history save --prefix builtin history save --prefix
#CHECKERR: history: you cannot use any options with the save command #CHECKERR: history: save: subcommand takes no options
builtin history clear --show-time builtin history clear --show-time
#CHECKERR: history: you cannot use any options with the clear command #CHECKERR: history: clear: subcommand takes no options
builtin history clear-session --show-time builtin history clear-session --show-time
#CHECKERR: history: you cannot use any options with the clear-session command #CHECKERR: history: clear-session: subcommand takes no options
builtin history merge xyz builtin history merge xyz
#CHECKERR: history merge: Expected 0 args, got 1 #CHECKERR: history: merge: expected 0 arguments; got 1
builtin history clear abc def builtin history clear abc def
#CHECKERR: history clear: Expected 0 args, got 2 #CHECKERR: history: clear: expected 0 arguments; got 2
builtin history clear-session abc def builtin history clear-session abc def
#CHECKERR: history clear-session: Expected 0 args, got 2 #CHECKERR: history: clear-session: expected 0 arguments; got 2
builtin history --contains save builtin history --contains save
#CHECKERR: history: you cannot use any options with the save command #CHECKERR: history: save: subcommand takes no options
builtin history -t merge builtin history -t merge
#CHECKERR: history: you cannot use any options with the merge command #CHECKERR: history: merge: subcommand takes no options
# Now do a history command that should succeed so we exit with a zero, # Now do a history command that should succeed so we exit with a zero,
# success, status. # success, status.

View file

@ -14,7 +14,7 @@ emit linenumber
# CHECK: 8 # CHECK: 8
type --nonexistent-option-so-we-get-a-backtrace type --nonexistent-option-so-we-get-a-backtrace
# CHECKERR: type: Unknown option '--nonexistent-option-so-we-get-a-backtrace' # CHECKERR: type: --nonexistent-option-so-we-get-a-backtrace: unknown option
function line-number function line-number
status line-number status line-number

View file

@ -107,17 +107,19 @@ echo "while true; end" | $fish --no-execute
for status in a b c for status in a b c
echo $status echo $status
end end
#CHECKERR: {{.*}}loops.fish (line {{\d+}}): You cannot use read-only variable 'status' in a for loop #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
echo $hostname echo $hostname
end end
#CHECKERR: {{.*}}loops.fish (line {{\d+}}): You cannot use read-only variable 'hostname' in a for loop #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

@ -130,9 +130,10 @@ not math '2 + 2 4'
# CHECKERR: '2 + 2 4' # CHECKERR: '2 + 2 4'
# CHECKERR: ^ # CHECKERR: ^
not math not math
# CHECKERR: math: Expected at least 1 args, got 0 # CHECKERR: math: expected >= 1 arguments; got 0
not math -s 12 not math -s 12
# CHECKERR: math: Expected at least 1 args, got 0 # CHECKERR: math: expected >= 1 arguments; got 0
# XXX FIXME these two should be just "missing argument" errors, the count is not helpful
not math 2^999999 not math 2^999999
# CHECKERR: math: Error: Result is infinite # CHECKERR: math: Error: Result is infinite
# CHECKERR: '2^999999' # CHECKERR: '2^999999'
@ -190,7 +191,7 @@ math --base hex 12 + 0x50
math --base octal --scale=0 55 math --base octal --scale=0 55
# CHECK: 067 # CHECK: 067
math --base notabase math --base notabase
# CHECKERR: math: 'notabase' is not a valid base value # CHECKERR: math: notabase: invalid base value
echo $status echo $status
# CHECK: 2 # CHECK: 2

View file

@ -7,27 +7,27 @@ set -l diff_max 18446744073709551614
# check failure cases # check failure cases
random a random a
#CHECKERR: random: Argument 'a' is not a valid integer #CHECKERR: random: a: invalid integer
random $diff_max random $diff_max
#CHECKERR: random: Argument '18446744073709551614' is not a valid integer #CHECKERR: random: 18446744073709551614: invalid integer
random -- 1 2 3 4 random -- 1 2 3 4
#CHECKERR: random: Too many arguments #CHECKERR: random: too many arguments
random -- 10 -10 random -- 10 -10
#CHECKERR: random: END must be greater than START #CHECKERR: random: END must be greater than START
random -- 10 $diff_max random -- 10 $diff_max
#CHECKERR: random: Argument '18446744073709551614' is not a valid integer #CHECKERR: random: 18446744073709551614: invalid integer
random -- 1 1d random -- 1 1d
random -- 1 1c 10 random -- 1 1c 10
#CHECKERR: random: Argument '1d' is not a valid integer #CHECKERR: random: 1d: invalid integer
#CHECKERR: random: Argument '1c' is not a valid integer #CHECKERR: random: 1c: invalid integer
random -- 10 10 random -- 10 10
#CHECKERR: random: END must be greater than START #CHECKERR: random: END must be greater than START
random -- 1 - 10 random -- 1 - 10
#CHECKERR: random: Argument '-' is not a valid integer #CHECKERR: random: -: invalid integer
random -- 1 -1 10 random -- 1 -1 10
#CHECKERR: random: Argument '-1' is not a valid integer #CHECKERR: random: -1: invalid integer
random -- 1 $min 10 random -- 1 $min 10
#CHECKERR: random: Argument '-9223372036854775807' is not a valid integer #CHECKERR: random: -9223372036854775807: invalid integer
random -- 1 0 10 random -- 1 0 10
#CHECKERR: random: STEP must be a positive integer #CHECKERR: random: STEP must be a positive integer
random -- 1 11 10 random -- 1 11 10
@ -37,7 +37,7 @@ random -- 0 $diff_max $max
random choice random choice
#CHECKERR: random: nothing to choose from #CHECKERR: random: nothing to choose from
random choic a b c random choic a b c
#CHECKERR: random: Too many arguments #CHECKERR: random: too many arguments
function check_boundaries function check_boundaries
if not test $argv[1] -ge $argv[2] -a $argv[1] -le $argv[3] if not test $argv[1] -ge $argv[2] -a $argv[1] -le $argv[3]

View file

@ -6,9 +6,9 @@ read
# Read with -a and anything other than exactly on var name is an error # Read with -a and anything other than exactly on var name is an error
read -a read -a
#CHECKERR: read: Expected 1 args, got 0 #CHECKERR: read: expected 1 arguments; got 0
read --array v1 v2 read --array v1 v2
#CHECKERR: read: Expected 1 args, got 2 #CHECKERR: read: expected 1 arguments; got 2
read --list v1 read --list v1
# Verify correct behavior of subcommands and splitting of input. # Verify correct behavior of subcommands and splitting of input.

View file

@ -241,8 +241,9 @@ echo 7 $status # no passthrough
#CHECK: 7 4 #CHECK: 7 4
false false
set -h >/dev/null set -h >/dev/null
# CHECKERR: fish: Missing man page {{.*}} # CHECKERR: fish: set: missing man page
# CHECKERR: `help '{{.*}}'` will open the online version. # CHECKERR: Documentation may not be installed.
# CHECKERR: `help set` will show an online version
echo 8 $status # no passthrough echo 8 $status # no passthrough
#CHECK: 8 0 #CHECK: 8 0

View file

@ -451,12 +451,10 @@ env | grep __fish_empty_uvar
for a,b in y 1 z 3 for a,b in y 1 z 3
echo $a,$b echo $a,$b
end end
# CHECKERR: {{.*}} for: Variable name 'a,b' is not valid. See `help identifiers`. # CHECKERR: {{.*}} for: a,b: invalid variable. See `help identifiers`
# CHECKERR:
# 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
echo "global-vs-universal 1: $__fish_test_global_vs_universal" echo "global-vs-universal 1: $__fish_test_global_vs_universal"
@ -512,7 +510,7 @@ sh -c "EDITOR='vim -g' $FISH -c "'\'set -S EDITOR\'' | string match -r -e 'globa
# Verify behavior of `set --show` given an invalid var name # Verify behavior of `set --show` given an invalid var name
set --show 'argle bargle' set --show 'argle bargle'
#CHECKERR: set: Variable name 'argle bargle' is not valid. See `help identifiers`. #CHECKERR: set: argle bargle: invalid variable. See `help identifiers`
#CHECKERR: {{.*}}set.fish (line {{\d+}}): #CHECKERR: {{.*}}set.fish (line {{\d+}}):
#CHECKERR: set --show 'argle bargle' #CHECKERR: set --show 'argle bargle'
#CHECKERR: ^ #CHECKERR: ^
@ -711,14 +709,14 @@ echo $status
true true
set "" foo set "" foo
#CHECKERR: set: Variable name '' is not valid. See `help identifiers`. #CHECKERR: set: : invalid variable. See `help identifiers`
#CHECKERR: {{.*}}set.fish (line {{\d+}}): #CHECKERR: {{.*}}set.fish (line {{\d+}}):
#CHECKERR: set "" foo #CHECKERR: set "" foo
#CHECKERR: ^ #CHECKERR: ^
#CHECKERR: (Type 'help set' for related documentation) #CHECKERR: (Type 'help set' for related documentation)
set --show "" set --show ""
#CHECKERR: set: Variable name '' is not valid. See `help identifiers`. #CHECKERR: set: : invalid variable. See `help identifiers`
#CHECKERR: {{.*}}set.fish (line {{\d+}}): #CHECKERR: {{.*}}set.fish (line {{\d+}}):
#CHECKERR: set --show "" #CHECKERR: set --show ""
#CHECKERR: ^ #CHECKERR: ^

View file

@ -21,14 +21,13 @@ and echo '"status is-interactive" unexpectedly returned true for a non-interacti
# We should get an error message about an invalid combination of flags. # We should get an error message about an invalid combination of flags.
status --is-interactive --is-login status --is-interactive --is-login
#CHECKERR: status: Invalid combination of options, #CHECKERR: status: is-interactive is-login: options cannot be used together
#CHECKERR: you cannot do both 'is-interactive' and 'is-login' in the same invocation
# We should get an error message about an unexpected arg for `status # We should get an error message about an unexpected arg for `status
# is-block`. # is-block`.
status -b is-interactive status -b is-interactive
#CHECKERR: status: Invalid combination of options, #CHECKERR: status: is-block is-interactive: options cannot be used together
#CHECKERR: you cannot do both 'is-block' and 'is-interactive' in the same invocation # XXX this would be better if it referred to -b rather than what it is
# Try to set the job control to an invalid mode. # Try to set the job control to an invalid mode.
status job-control full1 status job-control full1

View file

@ -481,16 +481,16 @@ string repeat -m-1 foo; and echo "exit 0"
# CHECKERR: string repeat: Invalid max value '-1' # CHECKERR: string repeat: Invalid max value '-1'
string repeat -n notanumber foo; and echo "exit 0" string repeat -n notanumber foo; and echo "exit 0"
# CHECKERR: string repeat: Argument 'notanumber' is not a valid integer # CHECKERR: string repeat: notanumber: invalid integer
string repeat -m notanumber foo; and echo "exit 0" string repeat -m notanumber foo; and echo "exit 0"
# CHECKERR: string repeat: Argument 'notanumber' is not a valid integer # CHECKERR: string repeat: notanumber: invalid integer
echo stdin | string repeat -n1 "and arg"; and echo "exit 0" echo stdin | string repeat -n1 "and arg"; and echo "exit 0"
# CHECKERR: string repeat: Too many arguments # CHECKERR: string repeat: too many arguments
string repeat -n; and echo "exit 0" string repeat -n; and echo "exit 0"
# CHECKERR: string repeat: Expected argument for option n # CHECKERR: string repeat: -n: option requires an argument
# FIXME: Also triggers usage # FIXME: Also triggers usage
# string repeat -l fakearg # string repeat -l fakearg
@ -761,7 +761,7 @@ echo $status
function string function string
builtin string $argv builtin string $argv
end end
# CHECKERR: checks/string.fish (line {{\d+}}): function: The name 'string' is reserved, and cannot be used as a function name # CHECKERR: checks/string.fish (line {{\d+}}): function: string: cannot use reserved keyword as function name
# CHECKERR: function string # CHECKERR: function string
# CHECKERR: ^ # CHECKERR: ^