mirror of
https://github.com/amix/vimrc
synced 2025-06-16 09:35:01 +08:00
Replace YanRing with yank-stack and update plugins
This commit is contained in:
@ -7,6 +7,35 @@ set -euC
|
||||
vimgodir=$(cd -P "$(dirname "$0")/.." > /dev/null && pwd)
|
||||
cd "$vimgodir"
|
||||
|
||||
_usage() {
|
||||
echo "Usage: ${0##*/} [-hvc] [-r file] vim_version"
|
||||
echo
|
||||
echo "Options:"
|
||||
echo " -h Show this help"
|
||||
echo " -v Enable verbose output"
|
||||
echo " -r Run only the tests from this file"
|
||||
echo " -c Generate and submit code coverage reports"
|
||||
echo
|
||||
}
|
||||
|
||||
verbose=0
|
||||
run=""
|
||||
coverage=""
|
||||
while getopts "hvcr:" option; do
|
||||
case "$option" in
|
||||
h) _usage; exit 0 ;;
|
||||
v) verbose=1; ;;
|
||||
r) run=$OPTARG ;;
|
||||
c) coverage="-c" ;;
|
||||
*)
|
||||
echo "error: unknown option '$option'"
|
||||
_usage
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
shift $((OPTIND - 1))
|
||||
|
||||
### Setup Vim and other dependencies.
|
||||
#####################################
|
||||
if [ -z "${1:-}" ]; then
|
||||
@ -21,20 +50,33 @@ export GOPATH=$vimdir
|
||||
export PATH=${GOPATH}/bin:$PATH
|
||||
|
||||
if [ ! -f "$vimdir/bin/vim" ]; then
|
||||
echo "$vimdir/bin/vim doesn't exist; did you install it with the install-vim script?"
|
||||
exit 1
|
||||
echo "$vimdir/bin/vim doesn't exist; did you install it with the install-vim script?"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
### Run tests.
|
||||
##############
|
||||
# Clean stale log file.
|
||||
[ -f '/tmp/vim-go-test/test.log' ] && rm '/tmp/vim-go-test/test.log'
|
||||
[ -f '/tmp/vim-go-test/FAILED' ] && rm '/tmp/vim-go-test/FAILED'
|
||||
[ -f '/tmp/vim-go-test/test.log' ] && rm '/tmp/vim-go-test/test.log'
|
||||
[ -f '/tmp/vim-go-test/FAILED' ] && rm '/tmp/vim-go-test/FAILED'
|
||||
[ -f '/tmp/vim-go-test/cov-profile.txt' ] && rm '/tmp/vim-go-test/cov-profile.txt'
|
||||
[ -f '/tmp/vim-go-test/cov-report.txt' ] && rm '/tmp/vim-go-test/cov-report.txt'
|
||||
|
||||
# Run the actual tests.
|
||||
fail=0
|
||||
for test_file in "$vimgodir"/autoload/go/*_test.vim; do
|
||||
"$vimgodir/scripts/run-vim" $vim -e +"silent e $test_file" -S ./scripts/runtest.vim
|
||||
find "$vimgodir" -name '*_test.vim' | while read test_file; do
|
||||
[ -n "$run" -a "$(basename "$test_file")" != "$run" ] && continue
|
||||
|
||||
"$vimgodir/scripts/run-vim" $coverage $vim -e \
|
||||
+"silent e $test_file" \
|
||||
+"let g:test_verbose=$verbose" \
|
||||
-S ./scripts/runtest.vim || (
|
||||
# If Vim exits with non-0 it's almost certainly a bug in the test runner;
|
||||
# should very rarely happen in normal usage.
|
||||
echo 'test runner failure'
|
||||
cat '/tmp/vim-go-test/test.tmp'
|
||||
rm '/tmp/vim-go-test/test.tmp'
|
||||
exit 5
|
||||
)
|
||||
|
||||
# Append logs
|
||||
cat '/tmp/vim-go-test/test.tmp' | tee '/tmp/vim-go-test/test.log'
|
||||
@ -43,9 +85,17 @@ done
|
||||
|
||||
echo
|
||||
if [ -f "/tmp/vim-go-test/FAILED" ]; then
|
||||
echo 2>&1 "Some tests FAILED"
|
||||
echo 2>&1 "Some ($vim) tests FAILED"
|
||||
exit 1
|
||||
fi
|
||||
echo 2>&1 "All tests PASSED"
|
||||
echo 2>&1 "All ($vim) tests PASSED"
|
||||
|
||||
# Submit coverage reports
|
||||
if [ -n "$coverage" ]; then
|
||||
coverage xml --omit '*_test.vim'
|
||||
codecov -X search gcov pycov -f coverage.xml --required \
|
||||
--flags "$(echo "$vim" | sed -s 's/[-.]//g')"
|
||||
rm coverage.xml
|
||||
fi
|
||||
|
||||
# vim:ts=2:sts=2:sw=2:et
|
||||
|
Reference in New Issue
Block a user