2 # Script to run a language server unit tests
3 # The global variable TestName should be set to the name of the file
4 # containing the tests.
13 # Get the list of test functions in this file and call them
14 var fns: list<string> = execute('function /^Test_')
16 ->map("v:val->substitute('^def ', '', '')")
20 writefile(['No tests are found'], 'results.txt')
30 call add(v:errors, $'Error: Test {f} failed with exception {v:exception} at {v:throwpoint}')
33 call add(v:errors, $'Error: Test {f} generated error {v:errmsg}')
36 writefile(v:errors, 'results.txt', 'a')
37 writefile([$'{f}: FAIL'], 'results.txt', 'a')
39 writefile([$'{f}: pass'], 'results.txt', 'a')
46 exe $'source {g:TestName}'
50 writefile(['FAIL: Tests in ' .. g:TestName .. ' failed with exception ' .. v:exception .. ' at ' .. v:throwpoint], 'results.txt', 'a')
55 # vim: shiftwidth=2 softtabstop=2 noexpandtab