mirror of
https://github.com/amix/vimrc
synced 2025-06-16 01:25:00 +08:00
Replace YanRing with yank-stack and update plugins
This commit is contained in:
@ -7,6 +7,14 @@ set -euC
|
||||
vimgodir=$(cd -P "$(dirname "$0")/.." > /dev/null && pwd)
|
||||
cd "$vimgodir"
|
||||
|
||||
coverage=0
|
||||
while getopts "c" option; do
|
||||
case "$option" in
|
||||
c) coverage=1; ;;
|
||||
esac
|
||||
done
|
||||
shift $((OPTIND - 1))
|
||||
|
||||
if [ -z "${1:-}" ]; then
|
||||
echo "unknown version: '${1:-}'"
|
||||
echo "First argument must be 'vim-7.4', 'vim-8.0', or 'nvim'."
|
||||
@ -23,11 +31,20 @@ if [ ! -f "$dir/bin/vim" ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
$dir/bin/vim --noplugin -u NONE -N \
|
||||
+"set shm+=WAFI rtp=$dir/share/vim/vimgo packpath=$dir/share/vim/vimgo,$vimgodir" \
|
||||
+'filetype plugin indent on' \
|
||||
+'packloadall!' \
|
||||
"$@"
|
||||
if [ $coverage -eq 1 ]; then
|
||||
covimerage -q run --report-file /tmp/vim-go-test/cov-profile.txt --append \
|
||||
$dir/bin/vim --noplugin -u NONE -N \
|
||||
+"set shm+=WAFI rtp=$dir/share/vim/vimgo packpath=$dir/share/vim/vimgo,$vimgodir" \
|
||||
+'filetype plugin indent on' \
|
||||
+'packloadall!' \
|
||||
"$@"
|
||||
else
|
||||
$dir/bin/vim --noplugin -u NONE -N \
|
||||
+"set shm+=WAFI rtp=$dir/share/vim/vimgo packpath=$dir/share/vim/vimgo,$vimgodir" \
|
||||
+'filetype plugin indent on' \
|
||||
+'packloadall!' \
|
||||
"$@"
|
||||
fi
|
||||
|
||||
|
||||
# vim:ts=2:sts=2:sw=2:et
|
||||
|
@ -11,6 +11,9 @@ let s:fail = 0
|
||||
let s:done = 0
|
||||
let s:logs = []
|
||||
let s:gopath = $GOPATH
|
||||
if !exists('g:test_verbose')
|
||||
let g:test_verbose = 0
|
||||
endif
|
||||
|
||||
" Source the passed test file.
|
||||
source %
|
||||
@ -38,8 +41,14 @@ for s:test in sort(s:tests)
|
||||
endif
|
||||
|
||||
let s:started = reltime()
|
||||
call add(s:logs, printf("=== RUN %s", s:test[:-3]))
|
||||
exe 'call ' . s:test
|
||||
if g:test_verbose is 1
|
||||
call add(s:logs, printf("=== RUN %s", s:test[:-3]))
|
||||
endif
|
||||
try
|
||||
exe 'call ' . s:test
|
||||
catch
|
||||
let v:errors += [v:exception]
|
||||
endtry
|
||||
|
||||
" Restore GOPATH after each test.
|
||||
let $GOPATH = s:gopath
|
||||
@ -55,7 +64,9 @@ for s:test in sort(s:tests)
|
||||
" Reset so we can capture failures of the next test.
|
||||
let v:errors = []
|
||||
else
|
||||
call add(s:logs, printf("--- PASS %s (%ss)", s:test[:-3], s:elapsed_time))
|
||||
if g:test_verbose is 1
|
||||
call add(s:logs, printf("--- PASS %s (%ss)", s:test[:-3], s:elapsed_time))
|
||||
endif
|
||||
endif
|
||||
endfor
|
||||
|
||||
@ -76,9 +87,14 @@ let s:logs = s:logs + filter(split(s:mess, "\n"), 'v:val !~ "^Messages maintaine
|
||||
" Also store all internal messages from s:logs as well.
|
||||
silent! split /tmp/vim-go-test/test.tmp
|
||||
call append(line('$'), s:logs)
|
||||
call append(line('$'), printf("%s%s %s / %s tests",
|
||||
\ (s:fail > 0 ? 'FAIL ' : 'ok '),
|
||||
\ s:testfile, s:total_elapsed_time, s:done))
|
||||
call append(line('$'), printf("%s %s %s %ss / %s tests",
|
||||
\ (s:fail > 0 ? 'FAIL' : 'ok '),
|
||||
\ s:testfile,
|
||||
\ repeat(' ', 25 - len(s:testfile)),
|
||||
\ s:total_elapsed_time, s:done))
|
||||
if g:test_verbose is 0
|
||||
silent :g/^$/d
|
||||
endif
|
||||
silent! write
|
||||
|
||||
" Our work here is done.
|
||||
|
@ -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