mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-05-31 12:21:19 -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: ../rabbithole/
|
||||
|
||||
|
||||
# PWD should be imported and respected by fish
|
||||
cd $oldpwd
|
||||
mkdir -p $base/realhome
|
||||
@@ -84,7 +83,6 @@ set -l real_getcwd (pwd -P)
|
||||
env HOME=$base/linkhome $fish -c 'echo PWD is $PWD'
|
||||
#CHECK: PWD is {{.*}}/linkhome
|
||||
|
||||
|
||||
# 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
|
||||
test (realpath $output_pwd) = $real_getcwd
|
||||
@@ -225,10 +223,10 @@ function __fish_test_thrash_cd
|
||||
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
|
||||
|
||||
cd ""
|
||||
# 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!
|
||||
#
|
||||
# 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.
|
||||
echo fake/a
|
||||
echo fake/a/b
|
||||
@@ -297,7 +295,8 @@ else
|
||||
mkdir -p a/b/c
|
||||
chmod -r a
|
||||
|
||||
cd a; pwd
|
||||
cd a
|
||||
pwd
|
||||
# CHECK: {{.*}}/a
|
||||
|
||||
cd b
|
||||
|
||||
@@ -26,11 +26,10 @@ echo $status
|
||||
#CHECK: 127
|
||||
|
||||
set -g PATH .
|
||||
echo banana > foobar
|
||||
echo banana >foobar
|
||||
foobar --banana
|
||||
# CHECKERR: {{.*}}checks/command-not-found.fish (line {{\d+}}): Unknown command. './foobar' exists but is not an executable file.
|
||||
# CHECKERR: foobar --banana
|
||||
# CHECKERR: ^~~~~^
|
||||
|
||||
|
||||
exit 0
|
||||
|
||||
@@ -135,7 +135,8 @@ complete -C'foo -y' | string match -- -y-single-long
|
||||
# CHECK: -zARGZ
|
||||
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 -sfrie"
|
||||
# CHECK: -sgoodbye-friend
|
||||
@@ -483,17 +484,17 @@ complete -c thing -x -F
|
||||
# CHECKERR: complete: invalid option combination, '--exclusive' and '--force-files'
|
||||
# Multiple conditions
|
||||
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: test (count (commandline -xpc) -eq 1
|
||||
# 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 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 4' -n 'test (commandline -xpc)[-1] = heart' -a 'and'
|
||||
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 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 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 7' -n 'test (commandline -xpc)[-1] = to' -a 'blame'
|
||||
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 -C"shot "
|
||||
# CHECK: through
|
||||
@@ -503,18 +504,17 @@ complete -C"shot through "
|
||||
# See that conditions after a failing one aren't executed.
|
||||
set -g oops 0
|
||||
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 '
|
||||
echo $oops
|
||||
# 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 '
|
||||
# CHECK: oops
|
||||
echo $oops
|
||||
# CHECK: 1
|
||||
|
||||
|
||||
# See that we load completions only if the command exists in $PATH,
|
||||
# as a workaround for #3117.
|
||||
|
||||
@@ -620,7 +620,7 @@ function __fish_describe_command
|
||||
echo -e "whoami\twho am i"
|
||||
echo -e "which\which is it"
|
||||
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
|
||||
|
||||
set -l commands check search show
|
||||
|
||||
@@ -284,7 +284,7 @@ mkdir $tmpdir/realhome
|
||||
ln -s $tmpdir/realhome $tmpdir/linkhome
|
||||
set expandedtilde (env HOME=$tmpdir/linkhome $fish -c 'echo ~')
|
||||
if test $expandedtilde != $tmpdir/linkhome
|
||||
echo '~ expands to' $expandedtilde ' - expected ' $tmpdir/linkhome
|
||||
echo '~ expands to' $expandedtilde ' - expected ' $tmpdir/linkhome
|
||||
end
|
||||
rm $tmpdir/linkhome
|
||||
rmdir $tmpdir/realhome
|
||||
@@ -341,7 +341,7 @@ echo foo | $pager
|
||||
#CHECKERR: echo foo | $pager
|
||||
#CHECKERR: ^~~~~^
|
||||
|
||||
"command" -h
|
||||
command -h
|
||||
#CHECKERR: Documentation for command
|
||||
|
||||
echo {~,asdf}
|
||||
|
||||
@@ -36,7 +36,7 @@ git config --local alias.re 'restore --staged'
|
||||
# Test custom command completions by adding a command:
|
||||
|
||||
set -p PATH $PWD
|
||||
echo "echo foo" > git-frobnicate
|
||||
echo "echo foo" >git-frobnicate
|
||||
chmod +x git-frobnicate
|
||||
|
||||
complete -c git-frobnicate -xa 'foo bar baz'
|
||||
@@ -145,7 +145,7 @@ fish_git_prompt
|
||||
echo
|
||||
#CHECK: (newbranch)
|
||||
|
||||
echo "test" > foo
|
||||
echo test >foo
|
||||
fish_git_prompt
|
||||
echo
|
||||
#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
|
||||
git $identity commit -m Init >/dev/null
|
||||
echo 'changed' > foo
|
||||
echo changed >foo
|
||||
# (some git versions don't allow stash without giving an email)
|
||||
git $identity stash >/dev/null
|
||||
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_cleanstate
|
||||
|
||||
|
||||
# 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_showdirtystate 1
|
||||
@@ -192,12 +191,12 @@ set -g __fish_git_prompt_show_informative_status 1
|
||||
set -g __fish_git_prompt_showuntrackedfiles 1
|
||||
rm -Rf .git *
|
||||
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.sshCommand 'echo sshCommand >> ran.txt; false'
|
||||
git config diff.external 'echo diff >> ran.txt; false'
|
||||
touch untracked_file
|
||||
fish_git_prompt > /dev/null
|
||||
fish_git_prompt >/dev/null
|
||||
cat ran.txt # should output nothing
|
||||
|
||||
test "$(complete -C'git re ')" = "$(complete -C'git restore --staged ')"
|
||||
|
||||
@@ -53,7 +53,6 @@ echo $status
|
||||
#CHECK: 126
|
||||
rm file.fish
|
||||
|
||||
|
||||
# On to NUL bytes.
|
||||
# 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
|
||||
|
||||
@@ -20,7 +20,6 @@ end
|
||||
# CHECK: fish_variables is still a symlink
|
||||
rm $fish_variables
|
||||
|
||||
|
||||
# fish_history
|
||||
set -l history_file $XDG_DATA_HOME/fish/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
|
||||
|
||||
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
|
||||
#CHECK: good nt
|
||||
#CHECK: good nt
|
||||
#CHECK: good nt
|
||||
|
||||
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
|
||||
#CHECK: good ot
|
||||
#CHECK: good ot
|
||||
@@ -110,12 +110,12 @@ test -d
|
||||
#CHECKERR: test -d
|
||||
#CHECKERR: ^
|
||||
|
||||
test "foo"
|
||||
test foo
|
||||
#CHECKERR: test: Missing argument at index 2
|
||||
#CHECKERR: foo
|
||||
#CHECKERR: ^
|
||||
#CHECKERR: {{.*}}test.fish (line {{\d+}}):
|
||||
#CHECKERR: test "foo"
|
||||
#CHECKERR: test foo
|
||||
#CHECKERR: ^
|
||||
|
||||
test ""
|
||||
|
||||
Reference in New Issue
Block a user