1
0
Fork 0
mirror of synced 2024-11-18 06:55:33 -05:00
ultimate-vim/sources_non_forked/vim-go/scripts/bench-syntax
2018-10-14 21:43:54 +08:00

44 lines
1.1 KiB
Bash

#!/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:-}'"
echo "First argument must be 'vim-7.4', 'vim-8.0', or 'nvim'."
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"