runtime(syntax-tests): Introduce self tests for screen dumping

Write a batch of test files with made-up syntax to serve for
additional linewise checks to be manually performed whenever
the algorithm for screen dump file generation is modified.

Define a shell variable VIM_SYNTAX_SELF_TESTING to run these
tests:
	cd runtime/syntax/
	VIM_SYNTAX_SELF_TESTING=1 make clean test

related: #15150

Signed-off-by: Aliaksei Budavei <0x000c70@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
diff --git a/runtime/syntax/testdir/runtest.vim b/runtime/syntax/testdir/runtest.vim
index f2f86c0..3f45ecc 100644
--- a/runtime/syntax/testdir/runtest.vim
+++ b/runtime/syntax/testdir/runtest.vim
@@ -116,13 +116,17 @@
   let setup = glob('input/setup/*.vim', 1, 1)
     \ ->reduce({d, f -> extend(d, {fnamemodify(f, ':t:r'): f})}, {})
 
-  for fname in glob('input/*.*', 1, 1)
-    if fname =~ '\~$'
-      " backup file, skip
-      continue
-    endif
+  if exists("$VIM_SYNTAX_SELF_TESTING")
+    let dirpath = 'input/selftestdir/'
+    let fnames = readdir(dirpath, {fname -> fname !~ '^README.txt$'})
+  else
+    let dirpath = 'input/'
+    let fnames = readdir(dirpath, {fname -> fname !~ '\~$' && fname =~ '^.\+\..\+$'})
+  endif
 
-    let root = fnamemodify(fname, ':t:r')
+  for fname in fnames
+    let root = fnamemodify(fname, ':r')
+    let fname = dirpath .. fname
     let filetype = substitute(root, '\([^_.]*\)[_.].*', '\1', '')
     let failed_root = 'failed/' .. root