]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
runtime(syntax-tests): simplify code and allow filetype options
authorChristian Brabandt <cb@256bit.org>
Wed, 28 Feb 2024 20:24:25 +0000 (21:24 +0100)
committerChristian Brabandt <cb@256bit.org>
Wed, 28 Feb 2024 20:24:25 +0000 (21:24 +0100)
The whole testdir/runtest.vim is a bit of a mess. So this is an attempt
to improving the current state. First of all, let's move most of the
code into a single RunTest() function so that it's easier to run this
manually.

Then, let's add the possibility to customize filetype specific tests by
applying filetype specific options. We will make use of it in the next
commit, where the provided java file uses tabs, which cause line
wrapping which will then cause the scrolling to miss some lines when
redrawing (see #14105)

related: #14105

Signed-off-by: Christian Brabandt <cb@256bit.org>
21 files changed:
runtime/syntax/Makefile
runtime/syntax/testdir/dumps/c_00.dump
runtime/syntax/testdir/dumps/modula2_iso_00.dump
runtime/syntax/testdir/dumps/modula2_pim_00.dump
runtime/syntax/testdir/dumps/modula2_r10_00.dump
runtime/syntax/testdir/dumps/vim_ex_abbreviate_00.dump
runtime/syntax/testdir/dumps/vim_ex_behave_00.dump
runtime/syntax/testdir/dumps/vim_ex_behave_99.dump
runtime/syntax/testdir/dumps/vim_ex_commands_00.dump
runtime/syntax/testdir/dumps/vim_ex_echo_00.dump
runtime/syntax/testdir/dumps/vim_ex_map_00.dump
runtime/syntax/testdir/dumps/vim_ex_substitute_00.dump
runtime/syntax/testdir/dumps/vim_expr_00.dump
runtime/syntax/testdir/dumps/vim_key_notation_00.dump
runtime/syntax/testdir/dumps/vim_keymap_00.dump
runtime/syntax/testdir/dumps/vim_line_continuation_00.dump
runtime/syntax/testdir/dumps/vim_new_00.dump
runtime/syntax/testdir/dumps/vim_new_99.dump
runtime/syntax/testdir/dumps/vim_syntax_00.dump
runtime/syntax/testdir/dumps/vim_variables_00.dump
runtime/syntax/testdir/runtest.vim

index 945308fd7c4b14c3f60e0074116c9e05bb2b97a2..bc6de0bc26dac72120411e6681ab734d52cd745a 100644 (file)
@@ -1,5 +1,8 @@
 # Portable Makefile for running syntax tests.
 
+# To run the test manually:
+# ../../src/vim -u 'testdir/runtest.vim' --cmd 'breakadd func RunTest'
+
 # Override this if needed, the default assumes Vim was build in the src dir.
 #VIMPROG = vim
 VIMPROG = ../../src/vim
index d32cbd22ff1403458bd164a4e7a7937d6750c58c..46c42f1d68933227bf9311523969ae5e9ce12dd1 100644 (file)
@@ -17,4 +17,4 @@
 |#+0#e000e06&| |i|n|c|l|u|d|e| |<+0#e000002&|l|i|m|i|t|s|.|h|>| +0#0000000&@54
 |#+0#e000e06&|e|n|d|i|f| +0#0000000&@68
 @75
-|"|i|n|p|u|t|/|c|.|c|"| |1|2@1|L|,| |3|1|7|4|B| @33|1|,|1| @10|T|o|p| 
+@57|1|,|1| @10|T|o|p| 
index 797376fc1d5e496bcd4829bddaf1c8f6a7317323..0c24cb8603332f05aa0e928437883dc3d4564221 100644 (file)
@@ -17,4 +17,4 @@
 |(+0#0000e05&|*| |p|r|e|d|e|f|i|n|e|d| |c|o|n|s|t|a|n|t|s| |*|)| +0#0000000&@48
 |F+0#e000002&|A|L|S|E| +0#0000000&|N+0#e000002&|I|L| +0#0000000&|T+0#e000002&|R|U|E| +0#0000000&|I+0#e000002&|N|T|E|R@1|U|P|T|I|B|L|E| +0#0000000&|U+0#e000002&|N|I|N|T|E|R@1|U|P|T|I|B|L|E| +0#0000000&@30
 @75
-|"|i|n|p|u|t|/|m|o|d|u|l|a|2|_|i|s|o|.|d|e|f|"| |1@1|4|L|,| |2|3|1|8|B| @21|1|,|1| @10|T|o|p| 
+@57|1|,|1| @10|T|o|p| 
index 5e85b7aa806bd926fd344cf91d19aade63f32e84..36aa0deecda1c932f5edf2df852e0a61602da14a 100644 (file)
@@ -17,4 +17,4 @@
 |F+0#e000002&|A|L|S|E| +0#0000000&|N+0#e000002&|I|L| +0#0000000&|T+0#e000002&|R|U|E| +0#0000000&@60
 @75
 |(+0#0000e05&|*| |p|r|e|d|e|f|i|n|e|d| |t|y|p|e|s| |*|)| +0#0000000&@52
-|"|i|n|p|u|t|/|m|o|d|u|l|a|2|_|p|i|m|.|d|e|f|"| |1@2|L|,| |2|1|9|7|B| @21|1|,|1| @10|T|o|p| 
+@57|1|,|1| @10|T|o|p| 
index ab4167abf5b5fcfdccfadc8ee5424b84addd83a4..a2e475ef9f337dd44f2038187449864f9a88a3d1 100644 (file)
@@ -17,4 +17,4 @@
 |N+0#e000002&|I|L| +0#0000000&|F+0#e000002&|A|L|S|E| +0#0000000&|T+0#e000002&|R|U|E| +0#0000000&@60
 @75
 |(+0#0000e05&|*| |p|r|e|d|e|f|i|n|e|d| |t|y|p|e|s| |*|)| +0#0000000&@52
-|"|i|n|p|u|t|/|m|o|d|u|l|a|2|_|r|1|0|.|d|e|f|"| |1|4|6|L|,| |2|9|8|3|B| @21|1|,|1| @10|T|o|p| 
+@57|1|,|1| @10|T|o|p| 
index 68055d8a6ba9d3228258838846c255ff8a683ed1..5224a4f6e59891fc3ea326730a2725cb84781a4c 100644 (file)
@@ -17,4 +17,4 @@
 |i+0#af5f00255&|a|b@1|r|e|v| +0#0000000&|<+0#e000e06&|e|x|p|r|>| +0#0000000&|<+0#e000e06&|b|u|f@1|e|r|>| +0#0000000&|i|f|o@1| |c|f|o@1|b|a|r| @38
 @75
 |u+0#af5f00255&|n|a|b@1|r|e|v| +0#0000000&|<+0#e000e06&|b|u|f@1|e|r|>| +0#0000000&|f|o@1| @53
-|"|i|n|p|u|t|/|v|i|m|_|e|x|_|a|b@1|r|e|v|i|a|t|e|.|v|i|m|"| |2|5|L|,| |5@1|8|B| @17|1|,|1| @10|T|o|p| 
+@57|1|,|1| @10|T|o|p| 
index cd88b75375d66694f9518f3992d6c0a0bfa97a3c..b3c57de6f349aa062382e82f3329a5b273aaff8e 100644 (file)
@@ -17,4 +17,4 @@
 |~| @73
 |~| @73
 |~| @73
-|"+0#0000000&|i|n|p|u|t|/|v|i|m|_|e|x|_|b|e|h|a|v|e|.|v|i|m|"| |7|L|,| |7@1|B| @23|1|,|1| @10|A|l@1| 
+| +0#0000000&@56|1|,|1| @10|A|l@1| 
index a0a0e188c8f1c32a8551642dc4fe05907f11f445..c3fefebd3b519e5f14a665d236a941c394a3e8f7 100644 (file)
@@ -17,4 +17,4 @@
 |~| @73
 |~| @73
 |~| @73
-|"+0#0000000&|i|n|p|u|t|/|v|i|m|_|e|x|_|b|e|h|a|v|e|.|v|i|m|"| |7|L|,| |7@1|B| @23|7|,|1| @10|A|l@1| 
+| +0#0000000&@56|7|,|1| @10|A|l@1| 
index f3e48c0dbf581a3c6f4fdbe2473d23b8c7f49c46..863ae382c9e553b14cb2c5f3309477b156dfeecf 100644 (file)
@@ -17,4 +17,4 @@
 |:|3+0#af5f00255&|m|a|t|c|h| +0#0000000&@67
 |:+0#af5f00255&|a|p@1|e|n|d| +0#0000000&@67
 | +0#e000002&@3|t|e|x|t| +0#0000000&@66
-|"|i|n|p|u|t|/|v|i|m|_|e|x|_|c|o|m@1|a|n|d|s|.|v|i|m|"| |1@1|9|5|L|,| |1|7|3|0|1|B| @15|1|,|1| @10|T|o|p| 
+@57|1|,|1| @10|T|o|p| 
index 506c9e2d874a364353ce52626ab1d14894139db6..a626c7b2476fca12125388232055b364051b0a25 100644 (file)
@@ -17,4 +17,4 @@
 @75
 |"+0#0000e05&| |:|e|c|h|o| |w|i|t|h|o|u|t| |{|e|x|p|r|}| +0#0000000&@52
 |e+0#af5f00255&|c|h|o||+0#0000000&| |e+0#af5f00255&|c|h|o| +0#0000000&|"+0#e000002&|F|o@1|"| +0#0000000&@58
-|"|i|n|p|u|t|/|v|i|m|_|e|x|_|e|c|h|o|.|v|i|m|"| |2|0|L|,| |3|6|2|B| @23|1|,|1| @10|T|o|p| 
+@57|1|,|1| @10|T|o|p| 
index 032eeb41693dd4fd1427f71350f2d0f80ef2ed94..371c1ce6644110803b882dcecf4face03d384a6b 100644 (file)
@@ -17,4 +17,4 @@
 |o+0#af5f00255&|m|a|p|c|l|e|a|r| +0#0000000&|<+0#e000e06&|b|u|f@1|e|r|>| +0#0000000&@56
 |i+0#af5f00255&|m|a|p|c|l|e|a|r| +0#0000000&|<+0#e000e06&|b|u|f@1|e|r|>| +0#0000000&@56
 |l+0#af5f00255&|m|a|p|c|l|e|a|r| +0#0000000&|<+0#e000e06&|b|u|f@1|e|r|>| +0#0000000&@56
-|"|i|n|p|u|t|/|v|i|m|_|e|x|_|m|a|p|.|v|i|m|"| |2|1|L|,| |3|1|6|B| @24|1|,|1| @10|T|o|p| 
+@57|1|,|1| @10|T|o|p| 
index 31094c952d84e9db361d721991740e19c17c3f8f..aea97ed4bf5db33bd3f45343eb9af2790aa40fe1 100644 (file)
@@ -17,4 +17,4 @@
 |:|s+0#af5f00255&|m|a|g|i|c|/+0#e000e06&|f+0#0000000&|o@1|/+0#e000e06&|b+0#0000000&|a|r|/+0#e000e06&|c|e|g|i|I|n|p|#|l|r| +0#0000000&@48
 @75
 |c+0#af5f00255&|a|l@1| +0#0000000&|F|o@1|(+0#e000e06&|)| +0#0000000&||| |s+0#af5f00255&|u|b|s|t|i|t|u|t|e|/+0#e000e06&|f+0#0000000&|o@1|/+0#e000e06&|b+0#0000000&|a|r|/+0#e000e06&|&| +0#0000000&@41
-|"|i|n|p|u|t|/|v|i|m|_|e|x|_|s|u|b|s|t|i|t|u|t|e|.|v|i|m|"| |8|6|L|,| |1|5|1|0|B| @16|1|,|1| @10|T|o|p| 
+@57|1|,|1| @10|T|o|p| 
index dd1cfa71da196f42ac58cbc9b037622bb61c7337..899b73cd91a6cc6648f56ed9c66b8aa62b5dda3f 100644 (file)
@@ -17,4 +17,4 @@
 |e+0#af5f00255&|c|h|o| +0#0000000&|$+0#e000002&|'|\|3|1|6| |\|3|1| |\|3| |\|x|1|f| |\|x|f| |\|X|1|F| |\|X|F| |\|u|0|2|a|4| |\|U|0@4|2|a|4| |\|b| |\|e| |\|f| |\|n| |\|r| |\|t| |\@1
 | |\|"| |\|<|C|-|W|>|'| +0#0000000&@63
 |e+0#af5f00255&|c|h|o| +0#0000000&|$+0#e000002&|"|\+0#e000e06&|3|1|6|0+0#e000002&| |-| |\+0#e000e06&|x|1|f|0+0#e000002&| |-| |\+0#e000e06&|X|1|F|0+0#e000002&| |-| |\+0#e000e06&|u|0|2|a|4|0+0#e000002&| |-| |\+0#e000e06&|U|0@4|2|a|4|0+0#e000002&|"| +0#0000000&@21
-|"|i|n|p|u|t|/|v|i|m|_|e|x|p|r|.|v|i|m|"| |3|1|L|,| |1@1|6|2|B| @25|1|,|1| @10|T|o|p| 
+@57|1|,|1| @10|T|o|p| 
index 8b77cf347badf40fc89d18e1a2a7c890f98326da..ed58e2fdecd267e02ae1f01fa2b4cac53a4e8d60 100644 (file)
@@ -17,4 +17,4 @@
 |<+0#e000e06&|x|C|S|I|>| +0#0000000&@68
 |<+0#e000e06&|B|a|r|>| +0#0000000&@69
 |<+0#e000e06&|B|s|l|a|s|h|>| +0#0000000&@66
-|"|i|n|p|u|t|/|v|i|m|_|k|e|y|_|n|o|t|a|t|i|o|n|.|v|i|m|"| |1|6|3|L|,| |1|3|4|6|B| @16|1|,|1| @10|T|o|p| 
+@57|1|,|1| @10|T|o|p| 
index 974c5ad31ccb2bd31aae6acf9589e513e7b396a1..2c43e3dada7476e7cc8c6d849701191ce9dc10ba 100644 (file)
@@ -17,4 +17,4 @@
 |s+0#af5f00255&|c|r|i|p|t|e|n|c|o|d|i|n|g| +0#0000000&|u|t|f|-+0#af5f00255&|8+0#e000002&| +0#0000000&@54
 @75
 |@+0#4040ff13&@2| @71
-|"+0#0000000&|i|n|p|u|t|/|v|i|m|_|k|e|y|m|a|p|.|v|i|m|"| |2|6|L|,| |3|9@1|2|B| @23|1|,|1| @10|T|o|p| 
+| +0#0000000&@56|1|,|1| @10|T|o|p| 
index 7733c0b1a5824bc9012469349a0493a8738a3efd..3bc4ebaa503c966e1b7014e0856ac27608b656b2 100644 (file)
@@ -17,4 +17,4 @@
 @8|\+0#e000e06&| +0#0000000&|b+0#af5f00255&| +0#0000000&|=+0#af5f00255&| +0#0000000&|{+0#e000e06&|a+0#00e0e07&|:|b|}+0#e000e06&|,+0#0000000&| @54
 | +0#0000e05&@7|"|\| |p|r|i|n|t| |c| +0#0000000&@56
 @8|\+0#e000e06&| +0#0000000&|c+0#af5f00255&| +0#0000000&|=+0#af5f00255&| +0#0000000&|{+0#e000e06&|a+0#00e0e07&|:|c|}+0#e000e06&| +0#0000000&@55
-|"|i|n|p|u|t|/|v|i|m|_|l|i|n|e|_|c|o|n|t|i|n|u|a|t|i|o|n|.|v|i|m|"| |4|9|L|,| |6|2|6|B| @13|1|,|1| @10|T|o|p| 
+@57|1|,|1| @10|T|o|p| 
index 6306faefad978b26c439b81cf4ffe81b231c76b0..2ff76f4adfbfd7bee8cee645de2863142173fa7c 100644 (file)
@@ -17,4 +17,4 @@
 |q+0#af5f00255&|u|i|t| +0#0000000&@70
 |~+0#4040ff13&| @73
 |~| @73
-|"+0#0000000&|i|n|p|u|t|/|v|i|m|_|n|e|w|.|v|i|m|"| |1|7|L|,| |2|0|5|B| @27|1|,|1| @10|A|l@1| 
+| +0#0000000&@56|1|,|1| @10|A|l@1| 
index 50a54f2807a78be3d3801e3d5cd3bd73910730a2..a9fe50fad36a239a98e12627f4232db060f1fab5 100644 (file)
@@ -17,4 +17,4 @@
 >q+0#af5f00255&|u|i|t| +0#0000000&@70
 |~+0#4040ff13&| @73
 |~| @73
-|"+0#0000000&|i|n|p|u|t|/|v|i|m|_|n|e|w|.|v|i|m|"| |1|7|L|,| |2|0|5|B| @27|1|7|,|1| @9|A|l@1| 
+| +0#0000000&@56|1|7|,|1| @9|A|l@1| 
index 21dcc8893c69e6690b95b4c83789d5e246a4446d..916f96dc4abf75ff49286793eeead3f826ab5b38 100644 (file)
@@ -17,4 +17,4 @@
 @6|"+0#0000e05&|\| |c|o|n|t|a|i|n|e|d| |o|p|t|i|o|n| +0#0000000&@49
 @6|\+0#e000e06&| +0#0000000&|c+0#e000e06&|o|n|t|a|i|n|e|d| +0#0000000&@57
 @6|"+0#0000e05&|\| |c|o|n|t|a|i|n|e|d|i|n| |o|p|t|i|o|n| +0#0000000&@47
-|"|i|n|p|u|t|/|v|i|m|_|s|y|n|t|a|x|.|v|i|m|"| |1|6|4|L|,| |3|7|2|9|B| @22|1|,|1| @10|T|o|p| 
+@57|1|,|1| @10|T|o|p| 
index 97941134055d4c727d1ea4aa6bba021df3357d56..da77064afcbb51e0566b77863b8e482afc01bdb0 100644 (file)
@@ -17,4 +17,4 @@
 |l+0#af5f00255&|e|t| +0#0000000&|f+0#00e0e07&|o@1| +0#0000000&|/+0#af5f00255&|=| +0#0000000&|e|x|p|r| @59
 |l+0#af5f00255&|e|t| +0#0000000&|f+0#00e0e07&|o@1| +0#0000000&|%+0#af5f00255&|=| +0#0000000&|e|x|p|r| @59
 |l+0#af5f00255&|e|t| +0#0000000&|f+0#00e0e07&|o@1| +0#0000000&|.+0#af5f00255&|=| +0#0000000&|e|x|p|r| @59
-|"|i|n|p|u|t|/|v|i|m|_|v|a|r|i|a|b|l|e|s|.|v|i|m|"| |1|3|8|L|,| |1|5@1|4|B| @19|1|,|1| @10|T|o|p| 
+@57|1|,|1| @10|T|o|p| 
index d2ce3d19fa17c465631518bb842d60348be405bb..a2cdef3721b0f79ce400e749632bdd088c38952c 100644 (file)
@@ -85,164 +85,180 @@ func HandleSwapExists()
   endif
 endfunc
 
-let ok_count = 0
-let failed_tests = []
-let skipped_count = 0
-let MAX_FAILED_COUNT = 5
-for fname in glob('input/*.*', 1, 1)
-  if fname =~ '\~$'
-    " backup file, skip
-    continue
-  endif
+func RunTest()
+  let ok_count = 0
+  let failed_tests = []
+  let skipped_count = 0
+  let MAX_FAILED_COUNT = 5
+  for fname in glob('input/*.*', 1, 1)
+    if fname =~ '\~$'
+      " backup file, skip
+      continue
+    endif
+
+    let linecount = readfile(fname)->len()
+    let root = fnamemodify(fname, ':t:r')
+    let filetype = substitute(root, '\([^_.]*\)[_.].*', '\1', '')
+    let failed_root = 'failed/' .. root
+
+    " Execute the test if the "done" file does not exist or when the input file
+    " is newer.
+    let in_time = getftime(fname)
+    let out_time = getftime('done/' .. root)
+    if out_time < 0 || in_time > out_time
+      call ch_log('running tests for: ' .. fname)
+
+      for dumpname in glob(failed_root .. '_\d*\.dump', 1, 1)
+       call delete(dumpname)
+      endfor
+      call delete('done/' .. root)
 
-  let linecount = readfile(fname)->len()
-  let root = fnamemodify(fname, ':t:r')
-  let filetype = substitute(root, '\([^_.]*\)[_.].*', '\1', '')
-  let failed_root = 'failed/' .. root
-
-  " Execute the test if the "done" file does not exist or when the input file
-  " is newer.
-  let in_time = getftime(fname)
-  let out_time = getftime('done/' .. root)
-  if out_time < 0 || in_time > out_time
-    call ch_log('running tests for: ' .. fname)
-
-    for dumpname in glob(failed_root .. '_\d*\.dump', 1, 1)
-      call delete(dumpname)
-    endfor
-    call delete('done/' .. root)
-
-    let lines =<< trim END
-      syntax on
-
-      " extra info for shell variables
-      func ShellInfo()
-       let msg = ''
-       for [key, val] in items(b:)
-         if key =~ '^is_'
-           let msg ..= key .. ': ' .. val .. ', '
+      let lines =<< trim END
+       syntax on
+
+       " extra info for shell variables
+       func ShellInfo()
+         let msg = ''
+         for [key, val] in items(b:)
+           if key =~ '^is_'
+             let msg ..= key .. ': ' .. val .. ', '
+           endif
+         endfor
+         if msg != ''
+           echomsg msg
          endif
-       endfor
-       if msg != ''
-         echomsg msg
-       endif
-      endfunc
-
-      au! SwapExists * call HandleSwapExists()
-      func HandleSwapExists()
-       " Ignore finding a swap file for the test input, the user might be
-       " editing it and that's OK.
-       if expand('<afile>') =~ 'input[/\\].*\..*'
-         let v:swapchoice = 'e'
-       endif
-      endfunc
-    END
-    call writefile(lines, 'Xtestscript')
+       endfunc
+
+       au! SwapExists * call HandleSwapExists()
+       func HandleSwapExists()
+         " Ignore finding a swap file for the test input, the user might be
+         " editing it and that's OK.
+         if expand('<afile>') =~ 'input[/\\].*\..*'
+           let v:swapchoice = 'e'
+         endif
+       endfunc
+
+       func LoadFiletype(type)
+         for file in glob("ftplugin/" .. a:type .. "*.vim", 1, 1)
+           exe "source " .. file
+         endfor
+         redraw!
+       endfunc
+
+      END
+      call writefile(lines, 'Xtestscript')
+
+      " close all but the last window
+      while winnr('$') > 1
+       close
+      endwhile
+
+      " Redraw to make sure that messages are cleared and there is enough space
+      " for the terminal window.
+      redraw
+
+      let buf = RunVimInTerminal('-S Xtestscript', {})
+      " edit the file only after catching the SwapExists event
+      call term_sendkeys(buf, ":edit " .. fname .. "\<CR>")
+      " load filetype specific settings
+      call term_sendkeys(buf, ":call LoadFiletype('" .. filetype .. "')\<CR>")
+
+      if filetype == 'sh'
+       call term_sendkeys(buf, ":call ShellInfo()\<CR>")
+      endif
 
-    " close all but the last window
-    while winnr('$') > 1
-      close
-    endwhile
+      " Screendump at the start of the file: failed/root_00.dump
+      let root_00 = root .. '_00'
+      call ch_log('First screendump for ' .. fname .. ': failed/' .. root_00 .. '.dump')
+      let fail = VerifyScreenDump(buf, root_00, {})
 
-    " Redraw to make sure that messages are cleared and there is enough space
-    " for the terminal window.
-    redraw
+      " clear the shell info if there are not enough lines to cause a scroll
+      if filetype == 'sh' && linecount <= 19
+       call term_sendkeys(buf, ":redraw\<CR>")
+      endif
 
-    let buf = RunVimInTerminal('-S Xtestscript', {})
-    " edit the file only after catching the SwapExists event
-    call term_sendkeys(buf, ":edit " .. fname .. "\<CR>")
+      " Make a Screendump every 18 lines of the file: failed/root_NN.dump
+      let topline = 1
+      let nr = 1
+      while linecount - topline > 20
+       let topline += 18
+       call term_sendkeys(buf, printf("%dGzt", topline))
+       let root_next = root .. printf('_%02d', nr)
+       call ch_log('Next screendump for ' .. fname .. ': failed/' .. root_next .. '.dump')
+       let fail += VerifyScreenDump(buf, root_next, {})
+       let nr += 1
+      endwhile
+
+      " Screendump at the end of the file: failed/root_99.dump
+      call term_sendkeys(buf, 'Gzb')
+      let root_last = root .. '_99'
+      call ch_log('Last screendump for ' .. fname .. ': failed/' .. root_last .. '.dump')
+      let fail += VerifyScreenDump(buf, root_last, {})
+
+      call StopVimInTerminal(buf)
+      call delete('Xtestscript')
+
+      " redraw here to avoid the following messages to get mixed up with screen
+      " output.
+      redraw
+
+      " Add any assert errors to s:messages.
+      if len(v:errors) > 0
+       call extend(s:messages, v:errors)
+       " Echo the errors here, in case the script aborts or the "messages" file
+       " is not displayed later.
+       echomsg v:errors
+       let v:errors = []
+       let fail += 1
+      endif
 
-    if filetype == 'sh'
-      call term_sendkeys(buf, ":call ShellInfo()\<CR>")
-    endif
+      if fail == 0
+       call Message("Test " .. root .. " OK")
 
-    " Screendump at the start of the file: failed/root_00.dump
-    let root_00 = root .. '_00'
-    call ch_log('First screendump for ' .. fname .. ': failed/' .. root_00 .. '.dump')
-    let fail = VerifyScreenDump(buf, root_00, {})
+       call writefile(['OK'], 'done/' .. root)
 
-    " clear the shell info if there are not enough lines to cause a scroll
-    if filetype == 'sh' && linecount <= 19
-      call term_sendkeys(buf, ":redraw\<CR>")
-    endif
+       let ok_count += 1
+      else
+       call Message("Test " .. root .. " FAILED")
 
-    " Make a Screendump every 18 lines of the file: failed/root_NN.dump
-    let topline = 1
-    let nr = 1
-    while linecount - topline > 20
-      let topline += 18
-      call term_sendkeys(buf, printf("%dGzt", topline))
-      let root_next = root .. printf('_%02d', nr)
-      call ch_log('Next screendump for ' .. fname .. ': failed/' .. root_next .. '.dump')
-      let fail += VerifyScreenDump(buf, root_next, {})
-      let nr += 1
-    endwhile
-
-    " Screendump at the end of the file: failed/root_99.dump
-    call term_sendkeys(buf, 'Gzb')
-    let root_last = root .. '_99'
-    call ch_log('Last screendump for ' .. fname .. ': failed/' .. root_last .. '.dump')
-    let fail += VerifyScreenDump(buf, root_last, {})
-
-    call StopVimInTerminal(buf)
-    call delete('Xtestscript')
-
-    " redraw here to avoid the following messages to get mixed up with screen
-    " output.
-    redraw
-
-    " Add any assert errors to s:messages.
-    if len(v:errors) > 0
-      call extend(s:messages, v:errors)
-      " Echo the errors here, in case the script aborts or the "messages" file
-      " is not displayed later.
-      echomsg v:errors
-      let v:errors = []
-      let fail += 1
-    endif
+       call delete('done/' .. root)
 
-    if fail == 0
-      call Message("Test " .. root .. " OK")
-
-      call writefile(['OK'], 'done/' .. root)
-
-      let ok_count += 1
+       eval failed_tests->add(root)
+       if len(failed_tests) > MAX_FAILED_COUNT
+         call Message('')
+         call Message('Too many errors, aborting')
+       endif
+      endif
     else
-      call Message("Test " .. root .. " FAILED")
+      call Message("Test " .. root .. " skipped")
+      let skipped_count += 1
+    endif
 
-      call delete('done/' .. root)
+    " Append messages to the file "testdir/messages"
+    call AppendMessages('Input file ' .. fname .. ':')
 
-      eval failed_tests->add(root)
-      if len(failed_tests) > MAX_FAILED_COUNT
-       call Message('')
-       call Message('Too many errors, aborting')
-      endif
+    if len(failed_tests) > MAX_FAILED_COUNT
+      break
     endif
-  else
-    call Message("Test " .. root .. " skipped")
-    let skipped_count += 1
-  endif
+  endfor
 
-  " Append messages to the file "testdir/messages"
-  call AppendMessages('Input file ' .. fname .. ':')
+  call Message(s:test_run_message)
+  call Message('OK: ' .. ok_count)
+  call Message('FAILED: ' .. len(failed_tests) .. ': ' .. string(failed_tests))
+  call Message('skipped: ' .. skipped_count)
+  call AppendMessages('== SUMMARY ==')
 
-  if len(failed_tests) > MAX_FAILED_COUNT
-    break
+  if len(failed_tests) > 0
+    " have make report an error
+    cquit
   endif
-endfor
-
-call Message(s:test_run_message)
-call Message('OK: ' .. ok_count)
-call Message('FAILED: ' .. len(failed_tests) .. ': ' .. string(failed_tests))
-call Message('skipped: ' .. skipped_count)
-call AppendMessages('== SUMMARY ==')
+endfunc
 
-if len(failed_tests) > 0
-  " have make report an error
-  cquit
-endif
+call RunTest()
 
 " Matching "if 1" at the start.
 endif
 
 qall!
+
+" vim:ts=8