mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-26 03:35:17 +00:00
Tests: Don't cd to the tests directory!
We: 1. Set up a nice TMPDIR for our tests to use 2. Immediately `cd` to the directory containing the test runner. So instead we don't do (2), and stay in the temp directory, and explicitly use all the things from the test runner directory. I am fairly certain that cmake papered over this by adding a second layer of temp dir.
This commit is contained in:
parent
050fe09af1
commit
5e10d75a19
16 changed files with 46 additions and 40 deletions
|
@ -141,7 +141,7 @@ echo $status
|
|||
abbr --query banana --function
|
||||
echo $status
|
||||
# CHECKERR: abbr: --function: option requires an argument
|
||||
# CHECKERR: checks/abbr.fish (line 141):
|
||||
# CHECKERR: {{.*}}checks/abbr.fish (line 141):
|
||||
# CHECKERR: abbr --query banana --function
|
||||
# CHECKERR: ^
|
||||
# CHECKERR: (Type 'help abbr' for related documentation)
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
# No args (not even --) is an error
|
||||
argparse
|
||||
#CHECKERR: argparse: Missing -- separator
|
||||
#CHECKERR: checks/argparse.fish (line {{\d+}}):
|
||||
#CHECKERR: {{.*}}checks/argparse.fish (line {{\d+}}):
|
||||
#CHECKERR: argparse
|
||||
#CHECKERR: ^
|
||||
#CHECKERR: (Type 'help argparse' for related documentation)
|
||||
|
@ -19,7 +19,7 @@ argparse
|
|||
# Missing -- is an error
|
||||
argparse h/help
|
||||
#CHECKERR: argparse: Missing -- separator
|
||||
#CHECKERR: checks/argparse.fish (line {{\d+}}):
|
||||
#CHECKERR: {{.*}}checks/argparse.fish (line {{\d+}}):
|
||||
#CHECKERR: argparse h/help
|
||||
#CHECKERR: ^
|
||||
#CHECKERR: (Type 'help argparse' for related documentation)
|
||||
|
@ -40,27 +40,27 @@ argparse h/help:
|
|||
argparse h-help::
|
||||
argparse h-help=x
|
||||
#CHECKERR: argparse: Invalid option spec 'h-' at char '-'
|
||||
#CHECKERR: checks/argparse.fish (line {{\d+}}):
|
||||
#CHECKERR: {{.*}}checks/argparse.fish (line {{\d+}}):
|
||||
#CHECKERR: argparse h-
|
||||
#CHECKERR: ^
|
||||
#CHECKERR: (Type 'help argparse' for related documentation)
|
||||
#CHECKERR: argparse: Short flag '+' invalid, must be alphanum or '#'
|
||||
#CHECKERR: checks/argparse.fish (line {{\d+}}):
|
||||
#CHECKERR: {{.*}}checks/argparse.fish (line {{\d+}}):
|
||||
#CHECKERR: argparse +help
|
||||
#CHECKERR: ^
|
||||
#CHECKERR: (Type 'help argparse' for related documentation)
|
||||
#CHECKERR: argparse: Invalid option spec 'h/help:' at char ':'
|
||||
#CHECKERR: checks/argparse.fish (line {{\d+}}):
|
||||
#CHECKERR: {{.*}}checks/argparse.fish (line {{\d+}}):
|
||||
#CHECKERR: argparse h/help:
|
||||
#CHECKERR: ^
|
||||
#CHECKERR: (Type 'help argparse' for related documentation)
|
||||
#CHECKERR: argparse: Invalid option spec 'h-help::' at char ':'
|
||||
#CHECKERR: checks/argparse.fish (line {{\d+}}):
|
||||
#CHECKERR: {{.*}}checks/argparse.fish (line {{\d+}}):
|
||||
#CHECKERR: argparse h-help::
|
||||
#CHECKERR: ^
|
||||
#CHECKERR: (Type 'help argparse' for related documentation)
|
||||
#CHECKERR: argparse: Invalid option spec 'h-help=x' at char 'x'
|
||||
#CHECKERR: checks/argparse.fish (line {{\d+}}):
|
||||
#CHECKERR: {{.*}}checks/argparse.fish (line {{\d+}}):
|
||||
#CHECKERR: argparse h-help=x
|
||||
#CHECKERR: ^
|
||||
#CHECKERR: (Type 'help argparse' for related documentation)
|
||||
|
@ -89,7 +89,7 @@ end
|
|||
begin
|
||||
argparse '#-val=' -- abc -x def
|
||||
# CHECKERR: argparse: Implicit int short flag '#' does not allow modifiers like '='
|
||||
#CHECKERR: checks/argparse.fish (line {{\d+}}):
|
||||
#CHECKERR: {{.*}}checks/argparse.fish (line {{\d+}}):
|
||||
#CHECKERR: argparse '#-val=' -- abc -x def
|
||||
#CHECKERR: ^
|
||||
#CHECKERR: (Type 'help argparse' for related documentation)
|
||||
|
@ -105,7 +105,7 @@ end
|
|||
begin
|
||||
argparse s/short x/xray s/long -- -s -x --long
|
||||
# CHECKERR: argparse: Short flag 's' already defined
|
||||
#CHECKERR: checks/argparse.fish (line {{\d+}}):
|
||||
#CHECKERR: {{.*}}checks/argparse.fish (line {{\d+}}):
|
||||
#CHECKERR: argparse s/short x/xray s/long -- -s -x --long
|
||||
#CHECKERR: ^
|
||||
#CHECKERR: (Type 'help argparse' for related documentation)
|
||||
|
@ -115,7 +115,7 @@ end
|
|||
begin
|
||||
argparse s/short x/xray l/short -- -s -x --long
|
||||
# CHECKERR: argparse: Long flag 'short' already defined
|
||||
#CHECKERR: checks/argparse.fish (line {{\d+}}):
|
||||
#CHECKERR: {{.*}}checks/argparse.fish (line {{\d+}}):
|
||||
#CHECKERR: argparse s/short x/xray l/short -- -s -x --long
|
||||
#CHECKERR: ^
|
||||
#CHECKERR: (Type 'help argparse' for related documentation)
|
||||
|
@ -125,7 +125,7 @@ end
|
|||
begin
|
||||
argparse '#-val' x/xray 'v#val' -- -s -x --long
|
||||
# CHECKERR: argparse: Implicit int flag '#' already defined
|
||||
#CHECKERR: checks/argparse.fish (line {{\d+}}):
|
||||
#CHECKERR: {{.*}}checks/argparse.fish (line {{\d+}}):
|
||||
#CHECKERR: argparse '#-val' x/xray 'v#val' -- -s -x --long
|
||||
#CHECKERR: ^
|
||||
#CHECKERR: (Type 'help argparse' for related documentation)
|
||||
|
@ -135,7 +135,7 @@ end
|
|||
begin
|
||||
argparse 'v#val=' --
|
||||
# CHECKERR: argparse: Implicit int short flag 'v' does not allow modifiers like '='
|
||||
#CHECKERR: checks/argparse.fish (line {{\d+}}):
|
||||
#CHECKERR: {{.*}}checks/argparse.fish (line {{\d+}}):
|
||||
#CHECKERR: argparse 'v#val=' --
|
||||
#CHECKERR: ^
|
||||
#CHECKERR: (Type 'help argparse' for related documentation)
|
||||
|
@ -500,7 +500,7 @@ end
|
|||
begin
|
||||
argparse ''
|
||||
#CHECKERR: argparse: An option spec must have at least a short or a long flag
|
||||
#CHECKERR: checks/argparse.fish (line {{\d+}}):
|
||||
#CHECKERR: {{.*}}checks/argparse.fish (line {{\d+}}):
|
||||
#CHECKERR: argparse ''
|
||||
#CHECKERR: ^
|
||||
#CHECKERR: (Type 'help argparse' for related documentation)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#RUN: %fish -C 'set -g fish %fish' %s
|
||||
begin
|
||||
set -l dir $PWD/(dirname (status -f))
|
||||
set -l dir (dirname (status -f))
|
||||
set -gx XDG_CONFIG_HOME $dir/broken-config/
|
||||
set -gx HOME $dir/broken-config/
|
||||
$fish -l -c 'echo but still going'
|
||||
|
|
|
@ -35,7 +35,7 @@ echo $status
|
|||
set -g PATH .
|
||||
echo banana > foobar
|
||||
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: ^~~~~^
|
||||
|
||||
|
|
|
@ -40,6 +40,8 @@ complete -c t -fa '(t)'
|
|||
complete -C't '
|
||||
# CHECK: t
|
||||
|
||||
touch test.fish
|
||||
|
||||
# Ensure file completion happens even though it was disabled above.
|
||||
complete -c t -l fileoption -rF
|
||||
# Only match one file because I don't want to touch this any time we add a test file.
|
||||
|
|
|
@ -65,7 +65,7 @@ source /banana/\t/foo
|
|||
function eval
|
||||
builtin eval $argv
|
||||
end
|
||||
# CHECKERR: checks/eval.fish (line {{\d+}}): function: eval: cannot use reserved keyword as function name
|
||||
# CHECKERR: {{.*}}checks/eval.fish (line {{\d+}}): function: eval: cannot use reserved keyword as function name
|
||||
# CHECKERR: function eval
|
||||
# CHECKERR: ^
|
||||
|
||||
|
|
|
@ -337,7 +337,7 @@ printf '<%s>\n' ($fish -c 'echo "$abc["' 2>&1)
|
|||
|
||||
set -l pager command less
|
||||
echo foo | $pager
|
||||
#CHECKERR: checks/expansion.fish (line 339): The expanded command is a keyword.
|
||||
#CHECKERR: {{.*}}checks/expansion.fish (line 339): The expanded command is a keyword.
|
||||
#CHECKERR: echo foo | $pager
|
||||
#CHECKERR: ^~~~~^
|
||||
|
||||
|
|
|
@ -170,7 +170,7 @@ functions --no-details t2
|
|||
functions --no-details --details t
|
||||
# CHECKERR: functions: invalid option combination
|
||||
# CHECKERR:
|
||||
# CHECKERR: checks/functions.fish (line {{\d+}}):
|
||||
# CHECKERR: {{.*}}checks/functions.fish (line {{\d+}}):
|
||||
# CHECKERR: functions --no-details --details t
|
||||
# CHECKERR: ^
|
||||
# CHECKERR: (Type 'help functions' for related documentation)
|
||||
|
@ -205,7 +205,7 @@ functions --names -a | string match __fish_config_interactive
|
|||
|
||||
functions --description ""
|
||||
# CHECKERR: functions: Expected exactly one function name
|
||||
# CHECKERR: checks/functions.fish (line {{\d+}}):
|
||||
# CHECKERR: {{.*}}checks/functions.fish (line {{\d+}}):
|
||||
# CHECKERR: functions --description ""
|
||||
# CHECKERR: ^
|
||||
# CHECKERR: (Type 'help functions' for related documentation)
|
||||
|
|
|
@ -953,7 +953,7 @@ end
|
|||
|
||||
set -e undefined[x..]
|
||||
# CHECKERR: set: Invalid index starting at 'undefined'
|
||||
# CHECKERR: checks/set.fish (line 954):
|
||||
# CHECKERR: {{.*}}checks/set.fish (line {{\d+}}):
|
||||
# CHECKERR: set -e undefined[x..]
|
||||
# CHECKERR: ^
|
||||
# CHECKERR: (Type 'help set' for related documentation)
|
||||
|
|
|
@ -889,7 +889,7 @@ echo $status
|
|||
function string
|
||||
builtin string $argv
|
||||
end
|
||||
# CHECKERR: checks/string.fish (line {{\d+}}): function: string: cannot use reserved keyword as function name
|
||||
# CHECKERR: {{.*}}checks/string.fish (line {{\d+}}): function: string: cannot use reserved keyword as function name
|
||||
# CHECKERR: function string
|
||||
# CHECKERR: ^
|
||||
|
||||
|
|
|
@ -108,12 +108,12 @@ begin
|
|||
echo Matched!
|
||||
end
|
||||
# CHECKERR: fish: Unknown command: doesnotexist
|
||||
# CHECKERR: checks/switch.fish (line {{\d+}}):
|
||||
# CHECKERR: {{.*}}checks/switch.fish (line {{\d+}}):
|
||||
# CHECKERR: doesnotexist
|
||||
# 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: {{\t}}called on line {{\d+}} of file {{.*}}checks/switch.fish
|
||||
# CHECKERR: {{.*}}checks/switch.fish (line {{\d+}}): Unknown command
|
||||
# CHECKERR: switch (doesnotexist)
|
||||
# CHECKERR: ^~~~~~~~~~~~~^
|
||||
end
|
||||
|
|
|
@ -21,6 +21,7 @@ else
|
|||
echo fish_variables is still a symlink
|
||||
end
|
||||
# CHECK: fish_variables is still a symlink
|
||||
rm $fish_variables
|
||||
|
||||
|
||||
# fish_history
|
||||
|
@ -45,3 +46,4 @@ else
|
|||
echo fish_history is still a symlink
|
||||
end
|
||||
# CHECK: fish_history is still a symlink
|
||||
rm $history_file
|
||||
|
|
|
@ -9,7 +9,7 @@ ulimit --core-size
|
|||
ulimit 4352353252352352334
|
||||
#CHECKERR: ulimit: Invalid limit '4352353252352352334'
|
||||
#CHECKERR:
|
||||
#CHECKERR: checks/ulimit.fish (line {{\d+}}):
|
||||
#CHECKERR: {{.*}}checks/ulimit.fish (line {{\d+}}):
|
||||
#CHECKERR: ulimit 4352353252352352334
|
||||
#CHECKERR: ^
|
||||
#CHECKERR: (Type 'help ulimit' for related documentation)
|
||||
|
|
|
@ -12,7 +12,7 @@ touch ./b/file.txt
|
|||
set dirs ./a ./b
|
||||
echo $dirs/*.txt # CHECK: ./b/file.txt
|
||||
echo */foo/
|
||||
# CHECKERR: checks/wildcard.fish (line {{\d+}}): No matches for wildcard '*/foo/'. See `help wildcards-globbing`.
|
||||
# CHECKERR: {{.*}}checks/wildcard.fish (line {{\d+}}): No matches for wildcard '*/foo/'. See `help wildcards-globbing`.
|
||||
# CHECKERR: echo */foo/
|
||||
# CHECKERR: ^~~~~^
|
||||
|
||||
|
|
|
@ -6,21 +6,23 @@
|
|||
# `fish_update_completions` when running tests.
|
||||
set -gx FISH_UNIT_TESTS_RUNNING 1
|
||||
|
||||
# Change to directory containing this script
|
||||
cd (status dirname)
|
||||
# Save the directory containing this script
|
||||
# Do not *cd* here, otherwise you'll ruin our nice tmpdir setup!!!
|
||||
set -l scriptdir (status dirname)
|
||||
|
||||
# Test files specified on commandline, or all pexpect files.
|
||||
if set -q argv[1] && test -n "$argv[1]"
|
||||
set pexpect_files_to_test pexpects/$argv
|
||||
set pexpect_files_to_test $scriptdir/pexpects/$argv
|
||||
else if set -q FISH_PEXPECT_FILES
|
||||
set pexpect_files_to_test (string replace -r '^.*/(?=pexpects/)' '' -- $FISH_PEXPECT_FILES)
|
||||
else
|
||||
say -o cyan "Testing interactive functionality"
|
||||
set pexpect_files_to_test pexpects/*.py
|
||||
set pexpect_files_to_test $scriptdir/pexpects/*.py
|
||||
end
|
||||
|
||||
source test_util.fish || exit
|
||||
cat interactive.config >>$XDG_CONFIG_HOME/fish/config.fish
|
||||
source $scriptdir/test_util.fish || exit
|
||||
cat $scriptdir/interactive.config >>$XDG_CONFIG_HOME/fish/config.fish
|
||||
set -lx --prepend PYTHONPATH (realpath $scriptdir)
|
||||
|
||||
function test_pexpect_file
|
||||
set -l file $argv[1]
|
||||
|
@ -33,7 +35,6 @@ function test_pexpect_file
|
|||
# Help the script find the pexpect_helper module in our parent directory.
|
||||
set -q FISHDIR
|
||||
or set -l FISHDIR ../test/root/bin/
|
||||
set -lx --prepend PYTHONPATH (realpath $PWD)
|
||||
set -lx fish $FISHDIR/fish
|
||||
set -lx fish_key_reader $FISHDIR/fish_key_reader
|
||||
path is -fx -- $FISHDIR/fish_test_helper
|
||||
|
|
|
@ -8,15 +8,16 @@
|
|||
# `fish_update_completions` when running tests.
|
||||
set -x FISH_UNIT_TESTS_RUNNING 1
|
||||
|
||||
# Change to directory containing this script
|
||||
cd (status dirname)
|
||||
# Save the directory containing this script
|
||||
# Do not *cd* here, otherwise you'll ruin our nice tmpdir setup!!!
|
||||
set -l scriptdir (status dirname)
|
||||
|
||||
# Test files specified on commandline, or all checks.
|
||||
set -l files_to_test
|
||||
if set -q argv[1]
|
||||
set files_to_test checks/$argv.fish
|
||||
set files_to_test $scriptdir/checks/$argv.fish
|
||||
else
|
||||
set files_to_test checks/*.fish
|
||||
set files_to_test $scriptdir/checks/*.fish
|
||||
end
|
||||
|
||||
# Be less verbose when running tests one-by-one
|
||||
|
@ -41,11 +42,11 @@ if set -q files_to_test[1]
|
|||
test "$FISH_FORCE_COLOR" = 1
|
||||
and set force_color --force-color
|
||||
|
||||
$python -S littlecheck.py \
|
||||
$python -S $scriptdir/littlecheck.py \
|
||||
--progress $force_color \
|
||||
-s fish=$FISHDIR/fish \
|
||||
-s fish_test_helper=$fish_test_helper \
|
||||
-s filter-control-sequences="$FISHDIR/fish ../tests/filter-control-sequences.fish" \
|
||||
-s filter-control-sequences="$FISHDIR/fish $scriptdir/filter-control-sequences.fish" \
|
||||
$files_to_test
|
||||
|
||||
set -l littlecheck_status $status
|
||||
|
|
Loading…
Reference in a new issue