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>
diff --git a/runtime/syntax/testdir/tools/maketestdeps b/runtime/syntax/testdir/tools/maketestdeps
new file mode 100755
index 0000000..61bf061
--- /dev/null
+++ b/runtime/syntax/testdir/tools/maketestdeps
@@ -0,0 +1,38 @@
+#!/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