mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-07 10:01:14 -03:00
Run fish_indent on select test scripts
Run fish_indent on test scripts that will be modified in a later commit Not running it on all the files because a quarter of them need fixing, some of which are badly formatted on purpose
This commit is contained in:
committed by
Johannes Altmanninger
parent
9b75b6ee88
commit
7b8f97c1ff
@@ -74,7 +74,6 @@ complete -C'cd ../'
|
|||||||
#CHECK: ../a3/
|
#CHECK: ../a3/
|
||||||
#CHECK: ../rabbithole/
|
#CHECK: ../rabbithole/
|
||||||
|
|
||||||
|
|
||||||
# PWD should be imported and respected by fish
|
# PWD should be imported and respected by fish
|
||||||
cd $oldpwd
|
cd $oldpwd
|
||||||
mkdir -p $base/realhome
|
mkdir -p $base/realhome
|
||||||
@@ -84,7 +83,6 @@ set -l real_getcwd (pwd -P)
|
|||||||
env HOME=$base/linkhome $fish -c 'echo PWD is $PWD'
|
env HOME=$base/linkhome $fish -c 'echo PWD is $PWD'
|
||||||
#CHECK: PWD is {{.*}}/linkhome
|
#CHECK: PWD is {{.*}}/linkhome
|
||||||
|
|
||||||
|
|
||||||
# Do not inherit a virtual PWD that fails to resolve to getcwd (#5647)
|
# Do not inherit a virtual PWD that fails to resolve to getcwd (#5647)
|
||||||
env HOME=$base/linkhome PWD=/tmp $fish -c 'echo $PWD' | read output_pwd
|
env HOME=$base/linkhome PWD=/tmp $fish -c 'echo $PWD' | read output_pwd
|
||||||
test (realpath $output_pwd) = $real_getcwd
|
test (realpath $output_pwd) = $real_getcwd
|
||||||
@@ -225,10 +223,10 @@ function __fish_test_thrash_cd
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
__fish_test_thrash_cd |
|
__fish_test_thrash_cd |
|
||||||
__fish_test_thrash_cd |
|
__fish_test_thrash_cd |
|
||||||
__fish_test_thrash_cd |
|
__fish_test_thrash_cd |
|
||||||
__fish_test_thrash_cd |
|
__fish_test_thrash_cd |
|
||||||
__fish_test_thrash_cd
|
__fish_test_thrash_cd
|
||||||
|
|
||||||
cd ""
|
cd ""
|
||||||
# CHECKERR: cd: Empty directory '' does not exist
|
# CHECKERR: cd: Empty directory '' does not exist
|
||||||
@@ -285,7 +283,7 @@ complete -C'cd .'
|
|||||||
# Note that there is no kern.osproductversion under older OS X releases!
|
# Note that there is no kern.osproductversion under older OS X releases!
|
||||||
#
|
#
|
||||||
# NetBSD 10 does not support it.
|
# NetBSD 10 does not support it.
|
||||||
if test (uname) = NetBSD || begin; test (uname) = "Darwin" && test (sysctl kern.osproductversion 2>/dev/null | string match -r \\d+; or echo 10) -lt 12; end
|
if test (uname) = NetBSD || { test (uname) = Darwin && test (sysctl kern.osproductversion 2>/dev/null | string match -r \\d+; or echo 10) -lt 12 }
|
||||||
# Not supported. Satisfy the CHECKs below.
|
# Not supported. Satisfy the CHECKs below.
|
||||||
echo fake/a
|
echo fake/a
|
||||||
echo fake/a/b
|
echo fake/a/b
|
||||||
@@ -297,7 +295,8 @@ else
|
|||||||
mkdir -p a/b/c
|
mkdir -p a/b/c
|
||||||
chmod -r a
|
chmod -r a
|
||||||
|
|
||||||
cd a; pwd
|
cd a
|
||||||
|
pwd
|
||||||
# CHECK: {{.*}}/a
|
# CHECK: {{.*}}/a
|
||||||
|
|
||||||
cd b
|
cd b
|
||||||
|
|||||||
@@ -26,11 +26,10 @@ echo $status
|
|||||||
#CHECK: 127
|
#CHECK: 127
|
||||||
|
|
||||||
set -g PATH .
|
set -g PATH .
|
||||||
echo banana > foobar
|
echo banana >foobar
|
||||||
foobar --banana
|
foobar --banana
|
||||||
# CHECKERR: {{.*}}checks/command-not-found.fish (line {{\d+}}): Unknown command. './foobar' exists but is not an executable file.
|
# CHECKERR: {{.*}}checks/command-not-found.fish (line {{\d+}}): Unknown command. './foobar' exists but is not an executable file.
|
||||||
# CHECKERR: foobar --banana
|
# CHECKERR: foobar --banana
|
||||||
# CHECKERR: ^~~~~^
|
# CHECKERR: ^~~~~^
|
||||||
|
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
|||||||
@@ -135,7 +135,8 @@ complete -C'foo -y' | string match -- -y-single-long
|
|||||||
# CHECK: -zARGZ
|
# CHECK: -zARGZ
|
||||||
complete -C'foo -z'
|
complete -C'foo -z'
|
||||||
|
|
||||||
function foo2; end
|
function foo2
|
||||||
|
end
|
||||||
complete -c foo2 -s s -l long -xa "hello-world goodbye-friend"
|
complete -c foo2 -s s -l long -xa "hello-world goodbye-friend"
|
||||||
complete -C"foo2 -sfrie"
|
complete -C"foo2 -sfrie"
|
||||||
# CHECK: -sgoodbye-friend
|
# CHECK: -sgoodbye-friend
|
||||||
@@ -483,17 +484,17 @@ complete -c thing -x -F
|
|||||||
# CHECKERR: complete: invalid option combination, '--exclusive' and '--force-files'
|
# CHECKERR: complete: invalid option combination, '--exclusive' and '--force-files'
|
||||||
# Multiple conditions
|
# Multiple conditions
|
||||||
complete -f -c shot
|
complete -f -c shot
|
||||||
complete -fc shot -n 'test (count (commandline -xpc) -eq 1' -n 'test (commandline -xpc)[-1] = shot' -a 'through'
|
complete -fc shot -n 'test (count (commandline -xpc) -eq 1' -n 'test (commandline -xpc)[-1] = shot' -a through
|
||||||
# CHECKERR: complete: -n 'test (count (commandline -xpc) -eq 1': Unexpected end of string, expecting ')'
|
# CHECKERR: complete: -n 'test (count (commandline -xpc) -eq 1': Unexpected end of string, expecting ')'
|
||||||
# CHECKERR: test (count (commandline -xpc) -eq 1
|
# CHECKERR: test (count (commandline -xpc) -eq 1
|
||||||
# CHECKERR: ^
|
# CHECKERR: ^
|
||||||
complete -fc shot -n 'test (count (commandline -xpc)) -eq 1' -n 'test (commandline -xpc)[-1] = shot' -a 'through'
|
complete -fc shot -n 'test (count (commandline -xpc)) -eq 1' -n 'test (commandline -xpc)[-1] = shot' -a through
|
||||||
complete -fc shot -n 'test (count (commandline -xpc)) -eq 2' -n 'test (commandline -xpc)[-1] = through' -a 'the'
|
complete -fc shot -n 'test (count (commandline -xpc)) -eq 2' -n 'test (commandline -xpc)[-1] = through' -a the
|
||||||
complete -fc shot -n 'test (count (commandline -xpc)) -eq 3' -n 'test (commandline -xpc)[-1] = the' -a 'heart'
|
complete -fc shot -n 'test (count (commandline -xpc)) -eq 3' -n 'test (commandline -xpc)[-1] = the' -a heart
|
||||||
complete -fc shot -n 'test (count (commandline -xpc)) -eq 4' -n 'test (commandline -xpc)[-1] = heart' -a 'and'
|
complete -fc shot -n 'test (count (commandline -xpc)) -eq 4' -n 'test (commandline -xpc)[-1] = heart' -a and
|
||||||
complete -fc shot -n 'test (count (commandline -xpc)) -eq 5' -n 'test (commandline -xpc)[-1] = and' -a "you\'re"
|
complete -fc shot -n 'test (count (commandline -xpc)) -eq 5' -n 'test (commandline -xpc)[-1] = and' -a "you\'re"
|
||||||
complete -fc shot -n 'test (count (commandline -xpc)) -eq 6' -n 'test (commandline -xpc)[-1] = "you\'re"' -a 'to'
|
complete -fc shot -n 'test (count (commandline -xpc)) -eq 6' -n 'test (commandline -xpc)[-1] = "you\'re"' -a to
|
||||||
complete -fc shot -n 'test (count (commandline -xpc)) -eq 7' -n 'test (commandline -xpc)[-1] = to' -a 'blame'
|
complete -fc shot -n 'test (count (commandline -xpc)) -eq 7' -n 'test (commandline -xpc)[-1] = to' -a blame
|
||||||
|
|
||||||
complete -C"shot "
|
complete -C"shot "
|
||||||
# CHECK: through
|
# CHECK: through
|
||||||
@@ -503,18 +504,17 @@ complete -C"shot through "
|
|||||||
# See that conditions after a failing one aren't executed.
|
# See that conditions after a failing one aren't executed.
|
||||||
set -g oops 0
|
set -g oops 0
|
||||||
complete -fc oooops
|
complete -fc oooops
|
||||||
complete -fc oooops -n true -n true -n true -n 'false' -n 'set -g oops 1' -a oops
|
complete -fc oooops -n true -n true -n true -n false -n 'set -g oops 1' -a oops
|
||||||
complete -C'oooops '
|
complete -C'oooops '
|
||||||
echo $oops
|
echo $oops
|
||||||
# CHECK: 0
|
# CHECK: 0
|
||||||
|
|
||||||
complete -fc oooops -n 'true' -n 'set -g oops 1' -a oops
|
complete -fc oooops -n true -n 'set -g oops 1' -a oops
|
||||||
complete -C'oooops '
|
complete -C'oooops '
|
||||||
# CHECK: oops
|
# CHECK: oops
|
||||||
echo $oops
|
echo $oops
|
||||||
# CHECK: 1
|
# CHECK: 1
|
||||||
|
|
||||||
|
|
||||||
# See that we load completions only if the command exists in $PATH,
|
# See that we load completions only if the command exists in $PATH,
|
||||||
# as a workaround for #3117.
|
# as a workaround for #3117.
|
||||||
|
|
||||||
@@ -620,7 +620,7 @@ function __fish_describe_command
|
|||||||
echo -e "whoami\twho am i"
|
echo -e "whoami\twho am i"
|
||||||
echo -e "which\which is it"
|
echo -e "which\which is it"
|
||||||
end
|
end
|
||||||
test (count (complete -C"wh" | string match -rv "\tcommand|^while")) -gt 0 && echo "found" || echo "fail"
|
test (count (complete -C"wh" | string match -rv "\tcommand|^while")) -gt 0 && echo found || echo fail
|
||||||
# CHECK: found
|
# CHECK: found
|
||||||
|
|
||||||
set -l commands check search show
|
set -l commands check search show
|
||||||
|
|||||||
@@ -284,7 +284,7 @@ mkdir $tmpdir/realhome
|
|||||||
ln -s $tmpdir/realhome $tmpdir/linkhome
|
ln -s $tmpdir/realhome $tmpdir/linkhome
|
||||||
set expandedtilde (env HOME=$tmpdir/linkhome $fish -c 'echo ~')
|
set expandedtilde (env HOME=$tmpdir/linkhome $fish -c 'echo ~')
|
||||||
if test $expandedtilde != $tmpdir/linkhome
|
if test $expandedtilde != $tmpdir/linkhome
|
||||||
echo '~ expands to' $expandedtilde ' - expected ' $tmpdir/linkhome
|
echo '~ expands to' $expandedtilde ' - expected ' $tmpdir/linkhome
|
||||||
end
|
end
|
||||||
rm $tmpdir/linkhome
|
rm $tmpdir/linkhome
|
||||||
rmdir $tmpdir/realhome
|
rmdir $tmpdir/realhome
|
||||||
@@ -341,7 +341,7 @@ echo foo | $pager
|
|||||||
#CHECKERR: echo foo | $pager
|
#CHECKERR: echo foo | $pager
|
||||||
#CHECKERR: ^~~~~^
|
#CHECKERR: ^~~~~^
|
||||||
|
|
||||||
"command" -h
|
command -h
|
||||||
#CHECKERR: Documentation for command
|
#CHECKERR: Documentation for command
|
||||||
|
|
||||||
echo {~,asdf}
|
echo {~,asdf}
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ git config --local alias.re 'restore --staged'
|
|||||||
# Test custom command completions by adding a command:
|
# Test custom command completions by adding a command:
|
||||||
|
|
||||||
set -p PATH $PWD
|
set -p PATH $PWD
|
||||||
echo "echo foo" > git-frobnicate
|
echo "echo foo" >git-frobnicate
|
||||||
chmod +x git-frobnicate
|
chmod +x git-frobnicate
|
||||||
|
|
||||||
complete -c git-frobnicate -xa 'foo bar baz'
|
complete -c git-frobnicate -xa 'foo bar baz'
|
||||||
@@ -145,7 +145,7 @@ fish_git_prompt
|
|||||||
echo
|
echo
|
||||||
#CHECK: (newbranch)
|
#CHECK: (newbranch)
|
||||||
|
|
||||||
echo "test" > foo
|
echo test >foo
|
||||||
fish_git_prompt
|
fish_git_prompt
|
||||||
echo
|
echo
|
||||||
#CHECK: (newbranch *)
|
#CHECK: (newbranch *)
|
||||||
@@ -166,7 +166,7 @@ set -g ___fish_git_prompt_char_cleanstate ''
|
|||||||
|
|
||||||
set -l identity -c user.email=banana@example.com -c user.name=banana
|
set -l identity -c user.email=banana@example.com -c user.name=banana
|
||||||
git $identity commit -m Init >/dev/null
|
git $identity commit -m Init >/dev/null
|
||||||
echo 'changed' > foo
|
echo changed >foo
|
||||||
# (some git versions don't allow stash without giving an email)
|
# (some git versions don't allow stash without giving an email)
|
||||||
git $identity stash >/dev/null
|
git $identity stash >/dev/null
|
||||||
fish_git_prompt
|
fish_git_prompt
|
||||||
@@ -184,7 +184,6 @@ set -e __fish_git_prompt_status_order
|
|||||||
set -e ___fish_git_prompt_char_stashstate
|
set -e ___fish_git_prompt_char_stashstate
|
||||||
set -e ___fish_git_prompt_char_cleanstate
|
set -e ___fish_git_prompt_char_cleanstate
|
||||||
|
|
||||||
|
|
||||||
# Turn on everything and verify we correctly ignore sus config files.
|
# Turn on everything and verify we correctly ignore sus config files.
|
||||||
set -g __fish_git_prompt_status_order stagedstate invalidstate dirtystate untrackedfiles stashstate
|
set -g __fish_git_prompt_status_order stagedstate invalidstate dirtystate untrackedfiles stashstate
|
||||||
set -g __fish_git_prompt_showdirtystate 1
|
set -g __fish_git_prompt_showdirtystate 1
|
||||||
@@ -192,12 +191,12 @@ set -g __fish_git_prompt_show_informative_status 1
|
|||||||
set -g __fish_git_prompt_showuntrackedfiles 1
|
set -g __fish_git_prompt_showuntrackedfiles 1
|
||||||
rm -Rf .git *
|
rm -Rf .git *
|
||||||
git init >/dev/null 2>&1
|
git init >/dev/null 2>&1
|
||||||
echo -n > ran.txt
|
echo -n >ran.txt
|
||||||
git config core.fsmonitor 'echo fsmonitor >> ran.txt; false'
|
git config core.fsmonitor 'echo fsmonitor >> ran.txt; false'
|
||||||
git config core.sshCommand 'echo sshCommand >> ran.txt; false'
|
git config core.sshCommand 'echo sshCommand >> ran.txt; false'
|
||||||
git config diff.external 'echo diff >> ran.txt; false'
|
git config diff.external 'echo diff >> ran.txt; false'
|
||||||
touch untracked_file
|
touch untracked_file
|
||||||
fish_git_prompt > /dev/null
|
fish_git_prompt >/dev/null
|
||||||
cat ran.txt # should output nothing
|
cat ran.txt # should output nothing
|
||||||
|
|
||||||
test "$(complete -C'git re ')" = "$(complete -C'git restore --staged ')"
|
test "$(complete -C'git re ')" = "$(complete -C'git restore --staged ')"
|
||||||
|
|||||||
@@ -53,7 +53,6 @@ echo $status
|
|||||||
#CHECK: 126
|
#CHECK: 126
|
||||||
rm file.fish
|
rm file.fish
|
||||||
|
|
||||||
|
|
||||||
# On to NUL bytes.
|
# On to NUL bytes.
|
||||||
# The heuristic is that there must be a line containing a lowercase letter before the first NUL byte.
|
# The heuristic is that there must be a line containing a lowercase letter before the first NUL byte.
|
||||||
echo -n -e 'true\n\x00' >file
|
echo -n -e 'true\n\x00' >file
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ end
|
|||||||
# CHECK: fish_variables is still a symlink
|
# CHECK: fish_variables is still a symlink
|
||||||
rm $fish_variables
|
rm $fish_variables
|
||||||
|
|
||||||
|
|
||||||
# fish_history
|
# fish_history
|
||||||
set -l history_file $XDG_DATA_HOME/fish/fish_history
|
set -l history_file $XDG_DATA_HOME/fish/fish_history
|
||||||
set -l target_file $XDG_DATA_HOME/fish/target_fish_history
|
set -l target_file $XDG_DATA_HOME/fish/target_fish_history
|
||||||
|
|||||||
@@ -73,14 +73,14 @@ if not path mtime epoch | string match -qr -- '^[^-]'
|
|||||||
end
|
end
|
||||||
|
|
||||||
for file in epoch old newest
|
for file in epoch old newest
|
||||||
test $file -nt nonexist && echo good nt || echo $file: bad nt;
|
test $file -nt nonexist && echo good nt || echo $file: bad nt
|
||||||
end
|
end
|
||||||
#CHECK: good nt
|
#CHECK: good nt
|
||||||
#CHECK: good nt
|
#CHECK: good nt
|
||||||
#CHECK: good nt
|
#CHECK: good nt
|
||||||
|
|
||||||
for file in epoch old newest
|
for file in epoch old newest
|
||||||
test nonexist -ot $file && echo good ot || echo $file: bad ot;
|
test nonexist -ot $file && echo good ot || echo $file: bad ot
|
||||||
end
|
end
|
||||||
#CHECK: good ot
|
#CHECK: good ot
|
||||||
#CHECK: good ot
|
#CHECK: good ot
|
||||||
@@ -110,12 +110,12 @@ test -d
|
|||||||
#CHECKERR: test -d
|
#CHECKERR: test -d
|
||||||
#CHECKERR: ^
|
#CHECKERR: ^
|
||||||
|
|
||||||
test "foo"
|
test foo
|
||||||
#CHECKERR: test: Missing argument at index 2
|
#CHECKERR: test: Missing argument at index 2
|
||||||
#CHECKERR: foo
|
#CHECKERR: foo
|
||||||
#CHECKERR: ^
|
#CHECKERR: ^
|
||||||
#CHECKERR: {{.*}}test.fish (line {{\d+}}):
|
#CHECKERR: {{.*}}test.fish (line {{\d+}}):
|
||||||
#CHECKERR: test "foo"
|
#CHECKERR: test foo
|
||||||
#CHECKERR: ^
|
#CHECKERR: ^
|
||||||
|
|
||||||
test ""
|
test ""
|
||||||
|
|||||||
Reference in New Issue
Block a user