mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-26 04:43:10 +00:00
Allow running specific high-level tests by passing the name to test.fish
Example: tests/test.fish expansion This will run the tests in expansion.in only
This commit is contained in:
parent
8c17d48c83
commit
96589920d5
2 changed files with 20 additions and 3 deletions
15
tests/test.fish
Normal file → Executable file
15
tests/test.fish
Normal file → Executable file
|
@ -2,7 +2,18 @@
|
||||||
#
|
#
|
||||||
# Fishscript tests
|
# Fishscript tests
|
||||||
|
|
||||||
source test_util.fish (status -f); or exit
|
# Change to directory containing this script
|
||||||
|
cd (dirname (status -f))
|
||||||
|
|
||||||
|
# Test files specified on commandline, or all *.in files
|
||||||
|
set -q argv[1]
|
||||||
|
if set -q argv[1]
|
||||||
|
set files_to_test $argv.in
|
||||||
|
else
|
||||||
|
set files_to_test *.in
|
||||||
|
end
|
||||||
|
|
||||||
|
source test_util.fish (status -f) $argv; or exit
|
||||||
|
|
||||||
say -o cyan "Testing high level script functionality"
|
say -o cyan "Testing high level script functionality"
|
||||||
|
|
||||||
|
@ -46,7 +57,7 @@ function test_file
|
||||||
end
|
end
|
||||||
|
|
||||||
set -l failed
|
set -l failed
|
||||||
for i in *.in
|
for i in $files_to_test
|
||||||
if not test_file $i
|
if not test_file $i
|
||||||
set failed $failed $i
|
set failed $failed $i
|
||||||
end
|
end
|
||||||
|
|
|
@ -8,6 +8,12 @@ if test "$argv[1]" = (status -f)
|
||||||
exit 1
|
exit 1
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Any remaining arguments are passed back to test.fish
|
||||||
|
set -l args_for_test_script
|
||||||
|
if set -q argv[2]
|
||||||
|
set args_for_test_script $argv[2..-1]
|
||||||
|
end
|
||||||
|
|
||||||
function die
|
function die
|
||||||
set -q argv[1]; and echo $argv[1] >&2
|
set -q argv[1]; and echo $argv[1] >&2
|
||||||
exit 1
|
exit 1
|
||||||
|
@ -51,7 +57,7 @@ if not set -q __fish_is_running_tests
|
||||||
set -lx LC_$var ''
|
set -lx LC_$var ''
|
||||||
end
|
end
|
||||||
set -lx LC_CTYPE en_US.UTF-8
|
set -lx LC_CTYPE en_US.UTF-8
|
||||||
exec ../fish $script
|
exec ../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"
|
||||||
echo 'Something went wrong with the test runner.' >&2
|
echo 'Something went wrong with the test runner.' >&2
|
||||||
|
|
Loading…
Reference in a new issue