mirror of
https://github.com/fish-shell/fish-shell.git
synced 2025-03-15 23:22:53 +08:00
Cleanup test setup a bit
Put the env setup into test_util, which does some additional work. Also use some more builtins and stuff.
This commit is contained in:
parent
78bb1a6fa6
commit
61d322d403
@ -19,22 +19,7 @@ else
|
|||||||
set files_to_test checks/*.fish
|
set files_to_test checks/*.fish
|
||||||
end
|
end
|
||||||
|
|
||||||
# These env vars should not be inherited from the user environment because they can affect the
|
# test_util handles the environment setup and then restarts us
|
||||||
# behavior of the tests. So either remove them or set them to a known value.
|
|
||||||
# See also tests/interactive.fish.
|
|
||||||
set -gx TERM xterm
|
|
||||||
set -e COLORTERM
|
|
||||||
set -e INSIDE_EMACS
|
|
||||||
set -e ITERM_PROFILE
|
|
||||||
set -e KONSOLE_PROFILE_NAME
|
|
||||||
set -e KONSOLE_VERSION
|
|
||||||
set -e PANTHEON_TERMINAL_ID
|
|
||||||
set -e TERM_PROGRAM
|
|
||||||
set -e TERM_PROGRAM_VERSION
|
|
||||||
set -e VTE_VERSION
|
|
||||||
set -e WT_PROFILE_ID
|
|
||||||
set -e XTERM_VERSION
|
|
||||||
|
|
||||||
source test_util.fish (status -f) $argv
|
source test_util.fish (status -f) $argv
|
||||||
or exit
|
or exit
|
||||||
|
|
||||||
|
@ -26,19 +26,9 @@ end
|
|||||||
if not set -q __fish_is_running_tests
|
if not set -q __fish_is_running_tests
|
||||||
# Set up our test environment and re-run the original script.
|
# Set up our test environment and re-run the original script.
|
||||||
set -l script $argv[1]
|
set -l script $argv[1]
|
||||||
switch $script
|
|
||||||
case '/*'
|
|
||||||
# path is absolute
|
|
||||||
case '*'
|
|
||||||
# path is relative, make it absolute
|
|
||||||
set script $PWD/$script
|
|
||||||
end
|
|
||||||
|
|
||||||
begin
|
cd (builtin realpath (dirname $script))
|
||||||
dirname $script | read -l dir
|
or die
|
||||||
cd $dir
|
|
||||||
or die
|
|
||||||
end
|
|
||||||
|
|
||||||
set -lx XDG_DATA_HOME ../test/xdg_data_home
|
set -lx XDG_DATA_HOME ../test/xdg_data_home
|
||||||
rm -rf $XDG_DATA_HOME/fish
|
rm -rf $XDG_DATA_HOME/fish
|
||||||
@ -49,8 +39,8 @@ if not set -q __fish_is_running_tests
|
|||||||
mkdir -p $XDG_CONFIG_HOME/fish; or die
|
mkdir -p $XDG_CONFIG_HOME/fish; or die
|
||||||
ln -s $PWD/test_functions $XDG_CONFIG_HOME/fish/functions; or die
|
ln -s $PWD/test_functions $XDG_CONFIG_HOME/fish/functions; or die
|
||||||
|
|
||||||
set -l escaped_parent (dirname $PWD | sed -e 's/[\'\\\\]/\\\\&/g'); or die
|
set -l escaped_parent (builtin realpath $PWD/.. | string escape); or die
|
||||||
set -l escaped_config (printf '%s/fish' $XDG_CONFIG_HOME | sed -e 's/[\'\\\\]/\\\\&/g'); or die
|
set -l escaped_config (string escape -- $XDG_CONFIG_HOME/fish)
|
||||||
printf 'set fish_function_path \'%s/functions\' \'%s/share/functions\'\n' $escaped_config $escaped_parent >$XDG_CONFIG_HOME/fish/config.fish; or die
|
printf 'set fish_function_path \'%s/functions\' \'%s/share/functions\'\n' $escaped_config $escaped_parent >$XDG_CONFIG_HOME/fish/config.fish; or die
|
||||||
set -xl __fish_is_running_tests $XDG_CONFIG_HOME
|
set -xl __fish_is_running_tests $XDG_CONFIG_HOME
|
||||||
|
|
||||||
@ -69,6 +59,22 @@ if not set -q __fish_is_running_tests
|
|||||||
end
|
end
|
||||||
set -x LC_CTYPE en_US.UTF-8
|
set -x LC_CTYPE en_US.UTF-8
|
||||||
|
|
||||||
|
# These env vars should not be inherited from the user environment because they can affect the
|
||||||
|
# behavior of the tests. So either remove them or set them to a known value.
|
||||||
|
# See also tests/interactive.fish.
|
||||||
|
set -gx TERM xterm
|
||||||
|
set -e COLORTERM
|
||||||
|
set -e INSIDE_EMACS
|
||||||
|
set -e ITERM_PROFILE
|
||||||
|
set -e KONSOLE_PROFILE_NAME
|
||||||
|
set -e KONSOLE_VERSION
|
||||||
|
set -e PANTHEON_TERMINAL_ID
|
||||||
|
set -e TERM_PROGRAM
|
||||||
|
set -e TERM_PROGRAM_VERSION
|
||||||
|
set -e VTE_VERSION
|
||||||
|
set -e WT_PROFILE_ID
|
||||||
|
set -e XTERM_VERSION
|
||||||
|
|
||||||
exec ../test/root/bin/fish $script $args_for_test_script
|
exec ../test/root/bin/fish $script $args_for_test_script
|
||||||
die 'exec failed'
|
die 'exec failed'
|
||||||
else if test "$__fish_is_running_tests" != "$XDG_CONFIG_HOME"
|
else if test "$__fish_is_running_tests" != "$XDG_CONFIG_HOME"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user