fish-shell/tests/test.fish
Fabian Homborg 4d052da922 Remove classic ".in" test machinery
We have now entirely switched the script tests to littlecheck.

Note: This adjusts the complete_directories test, because it removes a
directory that was created before by a .in test. There's no real
change in behavior.

This does require the test directory be cleaned, or the tests will fail.

test_util gets to stay for a while longer, because it sets up the
testing env (locale and such).
2020-03-17 21:34:36 +01:00

53 lines
1.5 KiB
Fish

# Fishscript tests
#
# There is no shebang line because you shouldn't be running this by hand. You
# should be running it via `make test` to ensure the environment is properly
# setup.
# Set this var to modify behavior of the code being tests. Such as avoiding running
# `fish_update_completions` when running tests.
set -x FISH_UNIT_TESTS_RUNNING 1
# Change to directory containing this script
cd (dirname (status -f))
# Test files specified on commandline, or all *.in files
if set -q argv[1]
set files_to_test $argv.in
else
set files_to_test checks/*.fish
end
# 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 TERM xterm
set -e ITERM_PROFILE
source test_util.fish (status -f) $argv
or exit
say -o cyan "Testing high level script functionality"
set -g python (__fish_anypython)
# Test littlecheck files.
set littlecheck_files (string match '*.fish' -- $files_to_test)
if set -q littlecheck_files[1]
$python -S ../littlecheck.py \
--progress \
-s fish=../test/root/bin/fish \
-s fish_test_helper=../test/root/bin/fish_test_helper \
$littlecheck_files
set -l littlecheck_failures $status
set failed (math $failed + $littlecheck_failures)
end
if test $failed -eq 0
say green "All tests completed successfully"
exit 0
else
set plural (test $failed -eq 1; or echo s)
say red "$failed test$plural failed"
exit 1
end