vim/runtime/syntax/testdir/tools/maketestdeps
Eisuke Kawashima 2e18facede
test(runtime/syntax): improve syntax tests
When a syntax file is changed, timestamps of the corresponding files are
updated.

NOTE: At the moment this script does not strictly track dependency, like
cpp on c.

Also update ignore files

closes #16548

Co-authored-by: Aliaksei Budavei <0x000c70@gmail.com>
Signed-off-by: Eisuke Kawashima <e-kwsm@users.noreply.github.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2025-03-05 21:15:45 +01:00

38 lines
1.1 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
vim9_*.*) ft=vim;;
*_*.*) ft=${basename%%_*};;
*.*) ft=${basename%%.*};;
*) exit 1
esac
vimsetup=$dirname/setup/${basename%.*}.vim
if [ ! -r "$vimsetup" ]; then
vimsetup=
fi
cat << EOF
$input: $ft.vim $vimsetup
touch -c \$@
$basename:: $input
$ft:: $basename
EOF
done