2014-10-02 19:31:46 +00:00
|
|
|
# Fishscript tests
|
2016-02-07 02:08:22 +00:00
|
|
|
#
|
|
|
|
# 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.
|
2005-09-20 13:31:55 +00:00
|
|
|
|
2017-01-29 04:37:32 +00:00
|
|
|
# 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
|
|
|
|
|
2014-12-23 20:20:44 +00:00
|
|
|
# Change to directory containing this script
|
2020-06-14 17:11:57 +00:00
|
|
|
cd (status dirname)
|
2014-12-23 20:20:44 +00:00
|
|
|
|
2020-03-28 17:29:21 +00:00
|
|
|
# Test files specified on commandline, or all checks.
|
2020-05-15 05:56:06 +00:00
|
|
|
set -l files_to_test
|
2014-12-23 20:20:44 +00:00
|
|
|
if set -q argv[1]
|
2020-03-28 17:29:21 +00:00
|
|
|
set files_to_test checks/$argv.fish
|
2014-12-23 20:20:44 +00:00
|
|
|
else
|
2020-03-17 20:24:37 +00:00
|
|
|
set files_to_test checks/*.fish
|
2014-12-23 20:20:44 +00:00
|
|
|
end
|
|
|
|
|
2016-09-20 05:08:33 +00:00
|
|
|
# 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.
|
2020-09-04 15:55:55 +00:00
|
|
|
set -gx TERM xterm
|
2020-07-13 18:51:17 +00:00
|
|
|
set -e COLORTERM
|
|
|
|
set -e INSIDE_EMACS
|
2016-09-20 05:08:33 +00:00
|
|
|
set -e ITERM_PROFILE
|
2020-07-13 18:51:17 +00:00
|
|
|
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
|
2016-09-20 05:08:33 +00:00
|
|
|
|
2017-07-03 17:16:31 +00:00
|
|
|
source test_util.fish (status -f) $argv
|
|
|
|
or exit
|
2010-10-03 03:46:26 +00:00
|
|
|
|
2014-10-02 19:31:46 +00:00
|
|
|
say -o cyan "Testing high level script functionality"
|
2010-10-03 03:46:26 +00:00
|
|
|
|
2019-06-25 18:57:37 +00:00
|
|
|
set -g python (__fish_anypython)
|
|
|
|
|
2020-03-16 01:16:14 +00:00
|
|
|
# Test littlecheck files.
|
|
|
|
set littlecheck_files (string match '*.fish' -- $files_to_test)
|
|
|
|
if set -q littlecheck_files[1]
|
2020-03-09 19:52:45 +00:00
|
|
|
$python -S ../littlecheck.py \
|
2020-03-16 01:16:14 +00:00
|
|
|
--progress \
|
2020-01-13 19:34:22 +00:00
|
|
|
-s fish=../test/root/bin/fish \
|
|
|
|
-s fish_test_helper=../test/root/bin/fish_test_helper \
|
2020-03-16 01:16:14 +00:00
|
|
|
$littlecheck_files
|
|
|
|
set -l littlecheck_failures $status
|
|
|
|
set failed (math $failed + $littlecheck_failures)
|
2014-10-02 19:31:46 +00:00
|
|
|
end
|
2005-09-20 13:31:55 +00:00
|
|
|
|
2014-10-02 19:31:46 +00:00
|
|
|
if test $failed -eq 0
|
2020-03-28 17:41:44 +00:00
|
|
|
say green "All high level script tests completed successfully"
|
2014-10-02 19:31:46 +00:00
|
|
|
exit 0
|
|
|
|
else
|
|
|
|
set plural (test $failed -eq 1; or echo s)
|
|
|
|
say red "$failed test$plural failed"
|
|
|
|
exit 1
|
2005-09-20 13:31:55 +00:00
|
|
|
end
|