annotate runtime/syntax/testdir/runtest.vim @ 32631:f8a2fc7d823f v9.0.1647

patch 9.0.1647: insufficient testing for syntax plugins Commit: https://github.com/vim/vim/commit/1aa5f1c21fea60fe64cdcdf6990bf43ea5cc78a0 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Jun 22 21:57:51 2023 +0100 patch 9.0.1647: insufficient testing for syntax plugins Problem: Insufficient testing for syntax plugins. Solution: Add shell file examples. (Charles Campbell) Create a messages file for easier debugging and reporting the test results.
author Bram Moolenaar <Bram@vim.org>
date Thu, 22 Jun 2023 23:00:05 +0200
parents 92b93fe443e9
children a8577b9dab80
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
32591
92b93fe443e9 patch 9.0.1627: no generic mechanism to test syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1 " Runs all the syntax tests for which there is no "done/name" file.
92b93fe443e9 patch 9.0.1627: no generic mechanism to test syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2 "
92b93fe443e9 patch 9.0.1627: no generic mechanism to test syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3 " Current directory must be runtime/syntax.
92b93fe443e9 patch 9.0.1627: no generic mechanism to test syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
4
92b93fe443e9 patch 9.0.1627: no generic mechanism to test syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
5 " Only do this with the +eval feature
92b93fe443e9 patch 9.0.1627: no generic mechanism to test syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
6 if 1
92b93fe443e9 patch 9.0.1627: no generic mechanism to test syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
7
32631
f8a2fc7d823f patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents: 32591
diff changeset
8 " Remember the directory where we started. Will change to "testdir" below.
f8a2fc7d823f patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents: 32591
diff changeset
9 let syntaxDir = getcwd()
f8a2fc7d823f patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents: 32591
diff changeset
10
f8a2fc7d823f patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents: 32591
diff changeset
11 let s:messagesFname = fnameescape(syntaxDir .. '/testdir/messages')
f8a2fc7d823f patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents: 32591
diff changeset
12
f8a2fc7d823f patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents: 32591
diff changeset
13 let s:messages = []
f8a2fc7d823f patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents: 32591
diff changeset
14
f8a2fc7d823f patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents: 32591
diff changeset
15 " Add one message to the list of messages
f8a2fc7d823f patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents: 32591
diff changeset
16 func Message(msg)
f8a2fc7d823f patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents: 32591
diff changeset
17 echomsg a:msg
f8a2fc7d823f patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents: 32591
diff changeset
18 call add(s:messages, a:msg)
f8a2fc7d823f patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents: 32591
diff changeset
19 endfunc
f8a2fc7d823f patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents: 32591
diff changeset
20
f8a2fc7d823f patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents: 32591
diff changeset
21 " Report a fatal message and exit
f8a2fc7d823f patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents: 32591
diff changeset
22 func Fatal(msg)
f8a2fc7d823f patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents: 32591
diff changeset
23 echoerr a:msg
f8a2fc7d823f patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents: 32591
diff changeset
24 call AppendMessages(a:msg)
f8a2fc7d823f patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents: 32591
diff changeset
25 qall!
f8a2fc7d823f patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents: 32591
diff changeset
26 endfunc
f8a2fc7d823f patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents: 32591
diff changeset
27
f8a2fc7d823f patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents: 32591
diff changeset
28 " Append s:messages to the messages file and make it empty.
f8a2fc7d823f patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents: 32591
diff changeset
29 func AppendMessages(header)
f8a2fc7d823f patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents: 32591
diff changeset
30 exe 'split ' .. s:messagesFname
f8a2fc7d823f patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents: 32591
diff changeset
31 call append(line('$'), '')
f8a2fc7d823f patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents: 32591
diff changeset
32 call append(line('$'), a:header)
f8a2fc7d823f patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents: 32591
diff changeset
33 call append(line('$'), s:messages)
f8a2fc7d823f patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents: 32591
diff changeset
34 let s:messages = []
f8a2fc7d823f patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents: 32591
diff changeset
35 wq
f8a2fc7d823f patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents: 32591
diff changeset
36 endfunc
f8a2fc7d823f patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents: 32591
diff changeset
37
f8a2fc7d823f patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents: 32591
diff changeset
38 " Relevant messages are written to the "messages" file.
f8a2fc7d823f patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents: 32591
diff changeset
39 " If the file already exists it is appended to.
f8a2fc7d823f patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents: 32591
diff changeset
40 exe 'split ' .. s:messagesFname
f8a2fc7d823f patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents: 32591
diff changeset
41 call append(line('$'), repeat('=-', 70))
f8a2fc7d823f patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents: 32591
diff changeset
42 call append(line('$'), '')
f8a2fc7d823f patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents: 32591
diff changeset
43 call append(line('$'), 'Test run on ' .. strftime("%Y %b %d %H:%M:%S"))
f8a2fc7d823f patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents: 32591
diff changeset
44 wq
f8a2fc7d823f patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents: 32591
diff changeset
45
f8a2fc7d823f patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents: 32591
diff changeset
46 if syntaxDir !~ '[/\\]runtime[/\\]syntax\>'
f8a2fc7d823f patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents: 32591
diff changeset
47 call Fatal('Current directory must be "runtime/syntax"')
32591
92b93fe443e9 patch 9.0.1627: no generic mechanism to test syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
48 endif
92b93fe443e9 patch 9.0.1627: no generic mechanism to test syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
49 if !isdirectory('testdir')
32631
f8a2fc7d823f patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents: 32591
diff changeset
50 call Fatal('"testdir" directory not found')
32591
92b93fe443e9 patch 9.0.1627: no generic mechanism to test syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
51 endif
92b93fe443e9 patch 9.0.1627: no generic mechanism to test syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
52
92b93fe443e9 patch 9.0.1627: no generic mechanism to test syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
53 " Use the script for source code screendump testing. It sources other scripts,
92b93fe443e9 patch 9.0.1627: no generic mechanism to test syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
54 " therefore we must "cd" there.
92b93fe443e9 patch 9.0.1627: no generic mechanism to test syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
55 cd ../../src/testdir
92b93fe443e9 patch 9.0.1627: no generic mechanism to test syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
56 source screendump.vim
32631
f8a2fc7d823f patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents: 32591
diff changeset
57 exe 'cd ' .. fnameescape(syntaxDir)
32591
92b93fe443e9 patch 9.0.1627: no generic mechanism to test syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
58
92b93fe443e9 patch 9.0.1627: no generic mechanism to test syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
59 " For these tests we need to be able to run terminal Vim with 256 colors. On
92b93fe443e9 patch 9.0.1627: no generic mechanism to test syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
60 " MS-Windows the console only has 16 colors and the GUI can't run in a
92b93fe443e9 patch 9.0.1627: no generic mechanism to test syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
61 " terminal.
92b93fe443e9 patch 9.0.1627: no generic mechanism to test syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
62 if !CanRunVimInTerminal()
32631
f8a2fc7d823f patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents: 32591
diff changeset
63 call Fatal('Cannot make screendumps, aborting')
32591
92b93fe443e9 patch 9.0.1627: no generic mechanism to test syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
64 endif
92b93fe443e9 patch 9.0.1627: no generic mechanism to test syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
65
92b93fe443e9 patch 9.0.1627: no generic mechanism to test syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
66 cd testdir
92b93fe443e9 patch 9.0.1627: no generic mechanism to test syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
67 if !isdirectory('done')
92b93fe443e9 patch 9.0.1627: no generic mechanism to test syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
68 call mkdir('done')
92b93fe443e9 patch 9.0.1627: no generic mechanism to test syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
69 endif
92b93fe443e9 patch 9.0.1627: no generic mechanism to test syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
70
92b93fe443e9 patch 9.0.1627: no generic mechanism to test syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
71 set nocp
92b93fe443e9 patch 9.0.1627: no generic mechanism to test syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
72 set nowrapscan
92b93fe443e9 patch 9.0.1627: no generic mechanism to test syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
73 set report=9999
92b93fe443e9 patch 9.0.1627: no generic mechanism to test syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
74 set modeline
92b93fe443e9 patch 9.0.1627: no generic mechanism to test syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
75 set debug=throw
92b93fe443e9 patch 9.0.1627: no generic mechanism to test syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
76 set nomore
92b93fe443e9 patch 9.0.1627: no generic mechanism to test syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
77
92b93fe443e9 patch 9.0.1627: no generic mechanism to test syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
78 au! SwapExists * call HandleSwapExists()
92b93fe443e9 patch 9.0.1627: no generic mechanism to test syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
79 func HandleSwapExists()
92b93fe443e9 patch 9.0.1627: no generic mechanism to test syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
80 " Ignore finding a swap file for the test input, the user might be editing
92b93fe443e9 patch 9.0.1627: no generic mechanism to test syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
81 " it and that's OK.
92b93fe443e9 patch 9.0.1627: no generic mechanism to test syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
82 if expand('<afile>') =~ 'input[/\\].*\..*'
92b93fe443e9 patch 9.0.1627: no generic mechanism to test syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
83 let v:swapchoice = 'e'
92b93fe443e9 patch 9.0.1627: no generic mechanism to test syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
84 endif
92b93fe443e9 patch 9.0.1627: no generic mechanism to test syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
85 endfunc
92b93fe443e9 patch 9.0.1627: no generic mechanism to test syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
86
92b93fe443e9 patch 9.0.1627: no generic mechanism to test syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
87
32631
f8a2fc7d823f patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents: 32591
diff changeset
88 let ok_count = 0
32591
92b93fe443e9 patch 9.0.1627: no generic mechanism to test syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
89 let failed_count = 0
32631
f8a2fc7d823f patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents: 32591
diff changeset
90 let skipped_count = 0
f8a2fc7d823f patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents: 32591
diff changeset
91 let MAX_FAILED_COUNT = 5
32591
92b93fe443e9 patch 9.0.1627: no generic mechanism to test syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
92 for fname in glob('input/*.*', 1, 1)
92b93fe443e9 patch 9.0.1627: no generic mechanism to test syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
93 if fname =~ '\~$'
92b93fe443e9 patch 9.0.1627: no generic mechanism to test syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
94 " backup file, skip
92b93fe443e9 patch 9.0.1627: no generic mechanism to test syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
95 continue
92b93fe443e9 patch 9.0.1627: no generic mechanism to test syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
96 endif
92b93fe443e9 patch 9.0.1627: no generic mechanism to test syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
97
92b93fe443e9 patch 9.0.1627: no generic mechanism to test syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
98 let linecount = readfile(fname)->len()
32631
f8a2fc7d823f patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents: 32591
diff changeset
99 let root = fnamemodify(fname, ':t:r')
f8a2fc7d823f patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents: 32591
diff changeset
100 let filetype = substitute(root, '\([^_.]*\)[_.].*', '\1', '')
f8a2fc7d823f patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents: 32591
diff changeset
101 let failed_root = 'failed/' .. root
32591
92b93fe443e9 patch 9.0.1627: no generic mechanism to test syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
102
32631
f8a2fc7d823f patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents: 32591
diff changeset
103 " Execute the test if the "done" file does not exist or when the input file
32591
92b93fe443e9 patch 9.0.1627: no generic mechanism to test syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
104 " is newer.
92b93fe443e9 patch 9.0.1627: no generic mechanism to test syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
105 let in_time = getftime(fname)
92b93fe443e9 patch 9.0.1627: no generic mechanism to test syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
106 let out_time = getftime('done/' .. root)
92b93fe443e9 patch 9.0.1627: no generic mechanism to test syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
107 if out_time < 0 || in_time > out_time
32631
f8a2fc7d823f patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents: 32591
diff changeset
108 call ch_log('running tests for: ' .. fname)
f8a2fc7d823f patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents: 32591
diff changeset
109
f8a2fc7d823f patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents: 32591
diff changeset
110 for dumpname in glob(failed_root .. '_\d*\.dump', 1, 1)
32591
92b93fe443e9 patch 9.0.1627: no generic mechanism to test syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
111 call delete(dumpname)
92b93fe443e9 patch 9.0.1627: no generic mechanism to test syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
112 endfor
92b93fe443e9 patch 9.0.1627: no generic mechanism to test syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
113 call delete('done/' .. root)
92b93fe443e9 patch 9.0.1627: no generic mechanism to test syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
114
92b93fe443e9 patch 9.0.1627: no generic mechanism to test syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
115 let lines =<< trim END
92b93fe443e9 patch 9.0.1627: no generic mechanism to test syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
116 syntax on
92b93fe443e9 patch 9.0.1627: no generic mechanism to test syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
117 END
92b93fe443e9 patch 9.0.1627: no generic mechanism to test syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
118 call writefile(lines, 'Xtestscript')
92b93fe443e9 patch 9.0.1627: no generic mechanism to test syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
119 let buf = RunVimInTerminal('-S Xtestscript ' .. fname, {})
92b93fe443e9 patch 9.0.1627: no generic mechanism to test syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
120
32631
f8a2fc7d823f patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents: 32591
diff changeset
121 " Screendump at the start of the file: failed/filetype_00.dump
f8a2fc7d823f patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents: 32591
diff changeset
122 let root_00 = root .. '_00'
f8a2fc7d823f patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents: 32591
diff changeset
123 call ch_log('First screendump for ' .. fname .. ': failed/' .. root_00 .. '.dump')
f8a2fc7d823f patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents: 32591
diff changeset
124 let fail = VerifyScreenDump(buf, root_00, {})
32591
92b93fe443e9 patch 9.0.1627: no generic mechanism to test syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
125
32631
f8a2fc7d823f patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents: 32591
diff changeset
126 " Make a Screendump every 18 lines of the file: failed/root_NN.dump
32591
92b93fe443e9 patch 9.0.1627: no generic mechanism to test syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
127 let topline = 1
92b93fe443e9 patch 9.0.1627: no generic mechanism to test syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
128 let nr = 1
92b93fe443e9 patch 9.0.1627: no generic mechanism to test syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
129 while linecount - topline > 20
92b93fe443e9 patch 9.0.1627: no generic mechanism to test syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
130 let topline += 18
92b93fe443e9 patch 9.0.1627: no generic mechanism to test syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
131 call term_sendkeys(buf, printf("%dGzt", topline))
32631
f8a2fc7d823f patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents: 32591
diff changeset
132 let root_next = root .. printf('_%02d', nr)
f8a2fc7d823f patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents: 32591
diff changeset
133 call ch_log('Next screendump for ' .. fname .. ': failed/' .. root_next .. '.dump')
f8a2fc7d823f patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents: 32591
diff changeset
134 let fail += VerifyScreenDump(buf, root_next, {})
32591
92b93fe443e9 patch 9.0.1627: no generic mechanism to test syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
135 let nr += 1
92b93fe443e9 patch 9.0.1627: no generic mechanism to test syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
136 endwhile
92b93fe443e9 patch 9.0.1627: no generic mechanism to test syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
137
32631
f8a2fc7d823f patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents: 32591
diff changeset
138 " Screendump at the end of the file: failed/root_99.dump
32591
92b93fe443e9 patch 9.0.1627: no generic mechanism to test syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
139 call term_sendkeys(buf, 'Gzb')
32631
f8a2fc7d823f patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents: 32591
diff changeset
140 let root_last = root .. '_99'
f8a2fc7d823f patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents: 32591
diff changeset
141 call ch_log('Last screendump for ' .. fname .. ': failed/' .. root_last .. '.dump')
f8a2fc7d823f patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents: 32591
diff changeset
142 let fail += VerifyScreenDump(buf, root_last, {})
32591
92b93fe443e9 patch 9.0.1627: no generic mechanism to test syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
143
92b93fe443e9 patch 9.0.1627: no generic mechanism to test syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
144 call StopVimInTerminal(buf)
92b93fe443e9 patch 9.0.1627: no generic mechanism to test syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
145 call delete('Xtestscript')
92b93fe443e9 patch 9.0.1627: no generic mechanism to test syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
146
32631
f8a2fc7d823f patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents: 32591
diff changeset
147 " Add any assert errors to s:messages
f8a2fc7d823f patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents: 32591
diff changeset
148 if len(v:errors) > 0
f8a2fc7d823f patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents: 32591
diff changeset
149 call extend(s:messages, v:errors)
f8a2fc7d823f patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents: 32591
diff changeset
150 let v:errors = []
f8a2fc7d823f patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents: 32591
diff changeset
151 let fail += 1
f8a2fc7d823f patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents: 32591
diff changeset
152 endif
f8a2fc7d823f patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents: 32591
diff changeset
153
32591
92b93fe443e9 patch 9.0.1627: no generic mechanism to test syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
154 if fail == 0
32631
f8a2fc7d823f patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents: 32591
diff changeset
155 call Message("Test " .. root .. " OK")
f8a2fc7d823f patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents: 32591
diff changeset
156
f8a2fc7d823f patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents: 32591
diff changeset
157 call writefile(['OK'], 'done/' .. root)
f8a2fc7d823f patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents: 32591
diff changeset
158
f8a2fc7d823f patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents: 32591
diff changeset
159 let ok_count += 1
32591
92b93fe443e9 patch 9.0.1627: no generic mechanism to test syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
160 else
32631
f8a2fc7d823f patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents: 32591
diff changeset
161 call Message("Test " .. root .. " FAILED")
f8a2fc7d823f patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents: 32591
diff changeset
162
f8a2fc7d823f patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents: 32591
diff changeset
163 call delete('done/' .. root)
f8a2fc7d823f patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents: 32591
diff changeset
164
32591
92b93fe443e9 patch 9.0.1627: no generic mechanism to test syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
165 let failed_count += 1
32631
f8a2fc7d823f patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents: 32591
diff changeset
166 if failed_count > MAX_FAILED_COUNT
f8a2fc7d823f patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents: 32591
diff changeset
167 call Message('')
f8a2fc7d823f patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents: 32591
diff changeset
168 call Message('Too many errors, aborting')
f8a2fc7d823f patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents: 32591
diff changeset
169 endif
32591
92b93fe443e9 patch 9.0.1627: no generic mechanism to test syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
170 endif
32631
f8a2fc7d823f patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents: 32591
diff changeset
171 else
f8a2fc7d823f patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents: 32591
diff changeset
172 let skipped_count += 1
f8a2fc7d823f patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents: 32591
diff changeset
173 endif
f8a2fc7d823f patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents: 32591
diff changeset
174
f8a2fc7d823f patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents: 32591
diff changeset
175 " Append messages to the file "testdir/messages"
f8a2fc7d823f patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents: 32591
diff changeset
176 call AppendMessages('Input file ' .. fname .. ':')
f8a2fc7d823f patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents: 32591
diff changeset
177
f8a2fc7d823f patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents: 32591
diff changeset
178 if failed_count > MAX_FAILED_COUNT
f8a2fc7d823f patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents: 32591
diff changeset
179 break
32591
92b93fe443e9 patch 9.0.1627: no generic mechanism to test syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
180 endif
92b93fe443e9 patch 9.0.1627: no generic mechanism to test syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
181 endfor
92b93fe443e9 patch 9.0.1627: no generic mechanism to test syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
182
92b93fe443e9 patch 9.0.1627: no generic mechanism to test syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
183 " Matching "if 1" at the start.
92b93fe443e9 patch 9.0.1627: no generic mechanism to test syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
184 endif
92b93fe443e9 patch 9.0.1627: no generic mechanism to test syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
185
32631
f8a2fc7d823f patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents: 32591
diff changeset
186 call Message('OK: ' .. ok_count)
f8a2fc7d823f patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents: 32591
diff changeset
187 call Message('FAILED: ' .. failed_count)
f8a2fc7d823f patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents: 32591
diff changeset
188 call Message('skipped: ' .. skipped_count)
f8a2fc7d823f patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents: 32591
diff changeset
189 call AppendMessages('== SUMMARY ==')
f8a2fc7d823f patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents: 32591
diff changeset
190
32591
92b93fe443e9 patch 9.0.1627: no generic mechanism to test syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
191 if failed_count > 0
92b93fe443e9 patch 9.0.1627: no generic mechanism to test syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
192 " have make report an error
92b93fe443e9 patch 9.0.1627: no generic mechanism to test syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
193 cquit
92b93fe443e9 patch 9.0.1627: no generic mechanism to test syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
194 endif
92b93fe443e9 patch 9.0.1627: no generic mechanism to test syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
195 qall!