nvim/pack/acp/start/vim-go/scripts/bench-syntax

45 lines
1 KiB
Text
Raw Normal View History

2019-06-03 14:58:18 +00:00
#!/bin/sh
#
# Benchmark the syntax/go.vim file.
#
# The first argument is the Vim version to test (as in run-vim), the rest of the
# agument are g:go_highlight_* settings (without that prefix). You can use "ALL"
# to set all the options.
#
set -euC
vimgodir=$(cd -P "$(dirname "$0")/.." > /dev/null && pwd)
cd "$vimgodir"
if [ -z "${1:-}" ]; then
echo "unknown version: '${1:-}'"
2020-10-28 13:35:24 +00:00
echo "First argument must be 'vim-8.0' or 'nvim'."
2019-06-03 14:58:18 +00:00
exit 1
fi
if [ -z "${2:-}" ]; then
echo "file not set"
echo "Second argument must be a Go file to benchmark, as 'filename:linenr'"
exit 1
fi
vim=$1
file="$(echo "$2" | cut -d : -f 1)"
line="$(echo "$2" | cut -d : -f 2)"
if [ -z "$line" -o "$line" = "$file" ]; then
echo "Second argument must be a Go file to benchmark, as 'filename:linenr'"
exit 1
fi
shift; shift
export RUNBENCH_SETTINGS=$@
export RUNBENCH_OUT="$(mktemp -p "${TMPDIR:-/tmp}" vimgo-bench.XXXXX)"
"$vimgodir/scripts/run-vim" $vim \
+"silent e $file" \
+"normal! ${line}G" \
-S ./scripts/runbench.vim
echo "Report written to:"
echo "$RUNBENCH_OUT"