Files
Aliaksei Budavei b6419b6fa5 runtime(syntax-tests): Apply "word" rather than "prefix" when filtering filetypes
Whenever two or more filetype names share a common prefix,
e.g. "java" and "javascript", passing the shortest name
argument to Make, e.g. "make java test", will trigger the
running of _all prefix matching_ test suites.  To fix this
blunder and to only have _requested_ test suites run, always
append the leftmost conventional delimiters "[._]", e.g.
"java[.]java", "java[_]numbers.java", to each filetype name
when automatically assembling a regexp pattern for the
filename filter.  Furthermore, promote the Vim9 (pseudo-)
filetype, e.g. "make vim9 test", "make vim vim9 test", etc.

As before, VIM_SYNTAX_TEST_FILTER is still within reach for
arbitrary test case grouping.

closes: #21351

Signed-off-by: Aliaksei Budavei <0x000c70@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2026-09-24 18:55:50 +00:00

38 lines
1.0 KiB
Bash
Executable File

#!/bin/bash
# This script generates auxiliary recipes for 'make test': e.g. in the case of JAVA,
# - a phony target 'java' depends on all of the testdir/input/java*.java
# - when the syntax file is changed, timestamps of the JAVA files are updated so that the tests will
# be rerun against updated syntax
# - when a vim setup file for test, e.g. testdir/input/setup/java_module_info.vim, is changed,
# timestamp of the corresponding input, testdir/input/java_module_info.java, is updated
#
# NOTE: At the moment this script DOES NOT strictly track dependency, like cpp on c, so run
# `make clean test` before deployment
set -eu +f -o pipefail
cd "$(dirname "$0")"/../..
for input in testdir/input/*.*; do
dirname=$(dirname "$input")
basename=$(basename "$input")
case "$basename" in
*_*.*) ft=${basename%%_*};;
*.*) ft=${basename%%.*};;
*) exit 1
esac
vimsetup=$dirname/setup/${basename%.*}.vim
if [ ! -r "$vimsetup" ]; then
vimsetup=
fi
cat << EOF
$input: ${ft/#vim9/vim}.vim $vimsetup
touch -c \$@
$basename:: $input
$ft:: $basename
EOF
done