mirror of
https://github.com/neovim/neovim.git
synced 2024-12-20 03:05:11 -07:00
test(report): formatting, drop dumplog()
Don't need to dumplog() on each failed test because we now have test-ids that associate log messages with tests.
This commit is contained in:
parent
8f06520594
commit
b6467dfc23
@ -1,4 +1,5 @@
|
|||||||
local pretty = require 'pl.pretty'
|
local pretty = require 'pl.pretty'
|
||||||
|
local global_helpers = require('test.helpers')
|
||||||
|
|
||||||
-- Colors are disabled by default. #15610
|
-- Colors are disabled by default. #15610
|
||||||
local colors = setmetatable({}, {__index = function() return function(s) return s == nil and '' or tostring(s) end end})
|
local colors = setmetatable({}, {__index = function() return function(s) return s == nil and '' or tostring(s) end end})
|
||||||
@ -25,35 +26,35 @@ return function(options)
|
|||||||
|
|
||||||
local repeatSuiteString = '\nRepeating all tests (run %d of %d) . . .\n\n'
|
local repeatSuiteString = '\nRepeating all tests (run %d of %d) . . .\n\n'
|
||||||
local randomizeString = c.note('Note: Randomizing test order with a seed of %d.\n')
|
local randomizeString = c.note('Note: Randomizing test order with a seed of %d.\n')
|
||||||
local globalSetup = c.sect('[----------]') .. ' Global test environment setup.\n'
|
local globalSetup = c.sect('--------') .. ' Global test environment setup.\n'
|
||||||
local fileStartString = c.sect('[----------]') .. ' Running tests from ' .. c.file('%s') .. '\n'
|
local fileStartString = c.sect('--------') .. ' Running tests from ' .. c.file('%s') .. '\n'
|
||||||
local runString = c.sect('[ RUN ]') .. ' ' .. c.test('%s') .. ': '
|
local runString = c.sect('RUN ') .. ' ' .. c.test('%s') .. ': '
|
||||||
local successString = c.succ('OK') .. '\n'
|
local successString = c.succ('OK') .. '\n'
|
||||||
local skippedString = c.skip('SKIP') .. '\n'
|
local skippedString = c.skip('SKIP') .. '\n'
|
||||||
local failureString = c.fail('FAIL') .. '\n'
|
local failureString = c.fail('FAIL') .. '\n'
|
||||||
local errorString = c.errr('ERR') .. '\n'
|
local errorString = c.errr('ERR') .. '\n'
|
||||||
local fileEndString = c.sect('[----------]') .. ' '.. c.nmbr('%d') .. ' %s from ' .. c.file('%s') .. ' ' .. c.time('(%.2f ms total)') .. '\n\n'
|
local fileEndString = c.sect('--------') .. ' '.. c.nmbr('%d') .. ' %s from ' .. c.file('%s') .. ' ' .. c.time('(%.2f ms total)') .. '\n\n'
|
||||||
local globalTeardown = c.sect('[----------]') .. ' Global test environment teardown.\n'
|
local globalTeardown = c.sect('--------') .. ' Global test environment teardown.\n'
|
||||||
local suiteEndString = c.sect('[==========]') .. ' ' .. c.nmbr('%d') .. ' %s from ' .. c.nmbr('%d') .. ' test %s ran. ' .. c.time('(%.2f ms total)') .. '\n'
|
local suiteEndString = c.sect('========') .. ' ' .. c.nmbr('%d') .. ' %s from ' .. c.nmbr('%d') .. ' test %s ran. ' .. c.time('(%.2f ms total)') .. '\n'
|
||||||
local successStatus = c.succ('[ PASSED ]') .. ' ' .. c.nmbr('%d') .. ' %s.\n'
|
local successStatus = c.succ('PASSED ') .. ' ' .. c.nmbr('%d') .. ' %s.\n'
|
||||||
local timeString = c.time('%.2f ms')
|
local timeString = c.time('%.2f ms')
|
||||||
|
|
||||||
local summaryStrings = {
|
local summaryStrings = {
|
||||||
skipped = {
|
skipped = {
|
||||||
header = c.skip('[ SKIPPED ]') .. ' ' .. c.nmbr('%d') .. ' %s, listed below:\n',
|
header = c.skip('SKIPPED ') .. ' ' .. c.nmbr('%d') .. ' %s, listed below:\n',
|
||||||
test = c.skip('[ SKIPPED ]') .. ' %s\n',
|
test = c.skip('SKIPPED ') .. ' %s\n',
|
||||||
footer = ' ' .. c.nmbr('%d') .. ' SKIPPED %s\n',
|
footer = ' ' .. c.nmbr('%d') .. ' SKIPPED %s\n',
|
||||||
},
|
},
|
||||||
|
|
||||||
failure = {
|
failure = {
|
||||||
header = c.fail('[ FAILED ]') .. ' ' .. c.nmbr('%d') .. ' %s, listed below:\n',
|
header = c.fail('FAILED ') .. ' ' .. c.nmbr('%d') .. ' %s, listed below:\n',
|
||||||
test = c.fail('[ FAILED ]') .. ' %s\n',
|
test = c.fail('FAILED ') .. ' %s\n',
|
||||||
footer = ' ' .. c.nmbr('%d') .. ' FAILED %s\n',
|
footer = ' ' .. c.nmbr('%d') .. ' FAILED %s\n',
|
||||||
},
|
},
|
||||||
|
|
||||||
error = {
|
error = {
|
||||||
header = c.errr('[ ERROR ]') .. ' ' .. c.nmbr('%d') .. ' %s, listed below:\n',
|
header = c.errr('ERROR ') .. ' ' .. c.nmbr('%d') .. ' %s, listed below:\n',
|
||||||
test = c.errr('[ ERROR ]') .. ' %s\n',
|
test = c.errr('ERROR ') .. ' %s\n',
|
||||||
footer = ' ' .. c.nmbr('%d') .. ' %s\n',
|
footer = ' ' .. c.nmbr('%d') .. ' %s\n',
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@ -193,6 +194,9 @@ return function(options)
|
|||||||
io.write(globalTeardown)
|
io.write(globalTeardown)
|
||||||
io.write(suiteEndString:format(testCount, tests, fileCount, files, elapsedTime_ms))
|
io.write(suiteEndString:format(testCount, tests, fileCount, files, elapsedTime_ms))
|
||||||
io.write(getSummaryString())
|
io.write(getSummaryString())
|
||||||
|
if failureCount > 0 or errorCount > 0 then
|
||||||
|
io.write(global_helpers.read_nvim_log(nil, true))
|
||||||
|
end
|
||||||
io.flush()
|
io.flush()
|
||||||
|
|
||||||
return nil, true
|
return nil, true
|
||||||
|
@ -266,8 +266,8 @@ describe('LSP', function()
|
|||||||
end;
|
end;
|
||||||
-- If the program timed out, then code will be nil.
|
-- If the program timed out, then code will be nil.
|
||||||
on_exit = function(code, signal)
|
on_exit = function(code, signal)
|
||||||
eq(0, code, "exit code", fake_lsp_logfile)
|
eq(0, code, "exit code")
|
||||||
eq(0, signal, "exit signal", fake_lsp_logfile)
|
eq(0, signal, "exit signal")
|
||||||
end;
|
end;
|
||||||
-- Note that NIL must be used here.
|
-- Note that NIL must be used here.
|
||||||
-- on_handler(err, method, result, client_id)
|
-- on_handler(err, method, result, client_id)
|
||||||
@ -288,8 +288,8 @@ describe('LSP', function()
|
|||||||
client.stop()
|
client.stop()
|
||||||
end;
|
end;
|
||||||
on_exit = function(code, signal)
|
on_exit = function(code, signal)
|
||||||
eq(101, code, "exit code", fake_lsp_logfile) -- See fake-lsp-server.lua
|
eq(101, code, "exit code") -- See fake-lsp-server.lua
|
||||||
eq(0, signal, "exit signal", fake_lsp_logfile)
|
eq(0, signal, "exit signal")
|
||||||
assert_log(pesc([[assert_eq failed: left == "\"shutdown\"", right == "\"test\""]]),
|
assert_log(pesc([[assert_eq failed: left == "\"shutdown\"", right == "\"test\""]]),
|
||||||
fake_lsp_logfile)
|
fake_lsp_logfile)
|
||||||
end;
|
end;
|
||||||
@ -335,8 +335,8 @@ describe('LSP', function()
|
|||||||
client.stop()
|
client.stop()
|
||||||
end;
|
end;
|
||||||
on_exit = function(code, signal)
|
on_exit = function(code, signal)
|
||||||
eq(0, code, "exit code", fake_lsp_logfile)
|
eq(0, code, "exit code")
|
||||||
eq(0, signal, "exit signal", fake_lsp_logfile)
|
eq(0, signal, "exit signal")
|
||||||
end;
|
end;
|
||||||
on_handler = function(...)
|
on_handler = function(...)
|
||||||
eq(table.remove(expected_handlers), {...}, "expected handler")
|
eq(table.remove(expected_handlers), {...}, "expected handler")
|
||||||
@ -367,8 +367,8 @@ describe('LSP', function()
|
|||||||
client.notify('finish')
|
client.notify('finish')
|
||||||
end;
|
end;
|
||||||
on_exit = function(code, signal)
|
on_exit = function(code, signal)
|
||||||
eq(0, code, "exit code", fake_lsp_logfile)
|
eq(0, code, "exit code")
|
||||||
eq(0, signal, "exit signal", fake_lsp_logfile)
|
eq(0, signal, "exit signal")
|
||||||
end;
|
end;
|
||||||
on_handler = function(err, result, ctx)
|
on_handler = function(err, result, ctx)
|
||||||
eq(table.remove(expected_handlers), {err, result, ctx}, "expected handler")
|
eq(table.remove(expected_handlers), {err, result, ctx}, "expected handler")
|
||||||
@ -436,8 +436,8 @@ describe('LSP', function()
|
|||||||
client = _client
|
client = _client
|
||||||
end;
|
end;
|
||||||
on_exit = function(code, signal)
|
on_exit = function(code, signal)
|
||||||
eq(0, code, "exit code", fake_lsp_logfile)
|
eq(0, code, "exit code")
|
||||||
eq(0, signal, "exit signal", fake_lsp_logfile)
|
eq(0, signal, "exit signal")
|
||||||
end;
|
end;
|
||||||
on_handler = function(err, result, ctx)
|
on_handler = function(err, result, ctx)
|
||||||
eq(table.remove(expected_handlers), {err, result, ctx}, "expected handler")
|
eq(table.remove(expected_handlers), {err, result, ctx}, "expected handler")
|
||||||
@ -496,8 +496,8 @@ describe('LSP', function()
|
|||||||
eq(false, client.server_capabilities().codeLensProvider)
|
eq(false, client.server_capabilities().codeLensProvider)
|
||||||
end;
|
end;
|
||||||
on_exit = function(code, signal)
|
on_exit = function(code, signal)
|
||||||
eq(0, code, "exit code", fake_lsp_logfile)
|
eq(0, code, "exit code")
|
||||||
eq(0, signal, "exit signal", fake_lsp_logfile)
|
eq(0, signal, "exit signal")
|
||||||
end;
|
end;
|
||||||
on_handler = function(...)
|
on_handler = function(...)
|
||||||
eq(table.remove(expected_handlers), {...}, "expected handler")
|
eq(table.remove(expected_handlers), {...}, "expected handler")
|
||||||
@ -517,8 +517,8 @@ describe('LSP', function()
|
|||||||
client = c
|
client = c
|
||||||
end;
|
end;
|
||||||
on_exit = function(code, signal)
|
on_exit = function(code, signal)
|
||||||
eq(0, code, "exit code", fake_lsp_logfile)
|
eq(0, code, "exit code")
|
||||||
eq(0, signal, "exit signal", fake_lsp_logfile)
|
eq(0, signal, "exit signal")
|
||||||
end;
|
end;
|
||||||
on_handler = function(err, result, ctx)
|
on_handler = function(err, result, ctx)
|
||||||
eq(table.remove(expected_handlers), {err, result, ctx}, "expected handler")
|
eq(table.remove(expected_handlers), {err, result, ctx}, "expected handler")
|
||||||
@ -547,8 +547,8 @@ describe('LSP', function()
|
|||||||
client = c
|
client = c
|
||||||
end;
|
end;
|
||||||
on_exit = function(code, signal)
|
on_exit = function(code, signal)
|
||||||
eq(0, code, "exit code", fake_lsp_logfile)
|
eq(0, code, "exit code")
|
||||||
eq(0, signal, "exit signal", fake_lsp_logfile)
|
eq(0, signal, "exit signal")
|
||||||
end;
|
end;
|
||||||
on_handler = function(err, result, ctx)
|
on_handler = function(err, result, ctx)
|
||||||
eq(table.remove(expected_handlers), {err, result, ctx}, "expected handler")
|
eq(table.remove(expected_handlers), {err, result, ctx}, "expected handler")
|
||||||
@ -596,8 +596,8 @@ describe('LSP', function()
|
|||||||
eq(true, client.supports_method("unknown-method"))
|
eq(true, client.supports_method("unknown-method"))
|
||||||
end;
|
end;
|
||||||
on_exit = function(code, signal)
|
on_exit = function(code, signal)
|
||||||
eq(0, code, "exit code", fake_lsp_logfile)
|
eq(0, code, "exit code")
|
||||||
eq(0, signal, "exit signal", fake_lsp_logfile)
|
eq(0, signal, "exit signal")
|
||||||
end;
|
end;
|
||||||
on_handler = function(...)
|
on_handler = function(...)
|
||||||
eq(table.remove(expected_handlers), {...}, "expected handler")
|
eq(table.remove(expected_handlers), {...}, "expected handler")
|
||||||
@ -626,8 +626,8 @@ describe('LSP', function()
|
|||||||
]]
|
]]
|
||||||
end;
|
end;
|
||||||
on_exit = function(code, signal)
|
on_exit = function(code, signal)
|
||||||
eq(0, code, "exit code", fake_lsp_logfile)
|
eq(0, code, "exit code")
|
||||||
eq(0, signal, "exit signal", fake_lsp_logfile)
|
eq(0, signal, "exit signal")
|
||||||
end;
|
end;
|
||||||
on_handler = function(...)
|
on_handler = function(...)
|
||||||
eq(table.remove(expected_handlers), {...}, "expected handler")
|
eq(table.remove(expected_handlers), {...}, "expected handler")
|
||||||
@ -651,8 +651,8 @@ describe('LSP', function()
|
|||||||
exec_lua("vim.lsp.buf.type_definition()")
|
exec_lua("vim.lsp.buf.type_definition()")
|
||||||
end;
|
end;
|
||||||
on_exit = function(code, signal)
|
on_exit = function(code, signal)
|
||||||
eq(0, code, "exit code", fake_lsp_logfile)
|
eq(0, code, "exit code")
|
||||||
eq(0, signal, "exit signal", fake_lsp_logfile)
|
eq(0, signal, "exit signal")
|
||||||
end;
|
end;
|
||||||
on_handler = function(...)
|
on_handler = function(...)
|
||||||
eq(table.remove(expected_handlers), {...}, "expected handler")
|
eq(table.remove(expected_handlers), {...}, "expected handler")
|
||||||
@ -672,8 +672,8 @@ describe('LSP', function()
|
|||||||
client = _client
|
client = _client
|
||||||
end;
|
end;
|
||||||
on_exit = function(code, signal)
|
on_exit = function(code, signal)
|
||||||
eq(0, code, "exit code", fake_lsp_logfile)
|
eq(0, code, "exit code")
|
||||||
eq(0, signal, "exit signal", fake_lsp_logfile)
|
eq(0, signal, "exit signal")
|
||||||
eq(0, #expected_handlers, "did not call expected handler")
|
eq(0, #expected_handlers, "did not call expected handler")
|
||||||
end;
|
end;
|
||||||
on_handler = function(err, _, ctx)
|
on_handler = function(err, _, ctx)
|
||||||
@ -696,8 +696,8 @@ describe('LSP', function()
|
|||||||
client = _client
|
client = _client
|
||||||
end;
|
end;
|
||||||
on_exit = function(code, signal)
|
on_exit = function(code, signal)
|
||||||
eq(0, code, "exit code", fake_lsp_logfile)
|
eq(0, code, "exit code")
|
||||||
eq(0, signal, "exit signal", fake_lsp_logfile)
|
eq(0, signal, "exit signal")
|
||||||
eq(0, #expected_handlers, "did not call expected handler")
|
eq(0, #expected_handlers, "did not call expected handler")
|
||||||
end;
|
end;
|
||||||
on_handler = function(err, _, ctx)
|
on_handler = function(err, _, ctx)
|
||||||
@ -726,8 +726,8 @@ describe('LSP', function()
|
|||||||
client.notify("release")
|
client.notify("release")
|
||||||
end;
|
end;
|
||||||
on_exit = function(code, signal)
|
on_exit = function(code, signal)
|
||||||
eq(0, code, "exit code", fake_lsp_logfile)
|
eq(0, code, "exit code")
|
||||||
eq(0, signal, "exit signal", fake_lsp_logfile)
|
eq(0, signal, "exit signal")
|
||||||
eq(0, #expected_handlers, "did not call expected handler")
|
eq(0, #expected_handlers, "did not call expected handler")
|
||||||
end;
|
end;
|
||||||
on_handler = function(err, _, ctx)
|
on_handler = function(err, _, ctx)
|
||||||
@ -759,8 +759,8 @@ describe('LSP', function()
|
|||||||
client.notify("release")
|
client.notify("release")
|
||||||
end;
|
end;
|
||||||
on_exit = function(code, signal)
|
on_exit = function(code, signal)
|
||||||
eq(0, code, "exit code", fake_lsp_logfile)
|
eq(0, code, "exit code")
|
||||||
eq(0, signal, "exit signal", fake_lsp_logfile)
|
eq(0, signal, "exit signal")
|
||||||
eq(0, #expected_handlers, "did not call expected handler")
|
eq(0, #expected_handlers, "did not call expected handler")
|
||||||
end;
|
end;
|
||||||
on_handler = function(err, _, ctx)
|
on_handler = function(err, _, ctx)
|
||||||
@ -793,8 +793,8 @@ describe('LSP', function()
|
|||||||
client.notify("release")
|
client.notify("release")
|
||||||
end;
|
end;
|
||||||
on_exit = function(code, signal)
|
on_exit = function(code, signal)
|
||||||
eq(0, code, "exit code", fake_lsp_logfile)
|
eq(0, code, "exit code")
|
||||||
eq(0, signal, "exit signal", fake_lsp_logfile)
|
eq(0, signal, "exit signal")
|
||||||
eq(0, #expected_handlers, "did not call expected handler")
|
eq(0, #expected_handlers, "did not call expected handler")
|
||||||
end;
|
end;
|
||||||
on_handler = function(err, _, ctx)
|
on_handler = function(err, _, ctx)
|
||||||
@ -828,8 +828,8 @@ describe('LSP', function()
|
|||||||
client.notify("release")
|
client.notify("release")
|
||||||
end;
|
end;
|
||||||
on_exit = function(code, signal)
|
on_exit = function(code, signal)
|
||||||
eq(0, code, "exit code", fake_lsp_logfile)
|
eq(0, code, "exit code")
|
||||||
eq(0, signal, "exit signal", fake_lsp_logfile)
|
eq(0, signal, "exit signal")
|
||||||
eq(0, #expected_handlers, "did not call expected handler")
|
eq(0, #expected_handlers, "did not call expected handler")
|
||||||
eq(3, eval('g:requests'))
|
eq(3, eval('g:requests'))
|
||||||
end;
|
end;
|
||||||
@ -874,8 +874,8 @@ describe('LSP', function()
|
|||||||
client.notify('finish')
|
client.notify('finish')
|
||||||
end;
|
end;
|
||||||
on_exit = function(code, signal)
|
on_exit = function(code, signal)
|
||||||
eq(0, code, "exit code", fake_lsp_logfile)
|
eq(0, code, "exit code")
|
||||||
eq(0, signal, "exit signal", fake_lsp_logfile)
|
eq(0, signal, "exit signal")
|
||||||
end;
|
end;
|
||||||
on_handler = function(err, result, ctx)
|
on_handler = function(err, result, ctx)
|
||||||
eq(table.remove(expected_handlers), {err, result, ctx}, "expected handler")
|
eq(table.remove(expected_handlers), {err, result, ctx}, "expected handler")
|
||||||
@ -917,8 +917,8 @@ describe('LSP', function()
|
|||||||
]]
|
]]
|
||||||
end;
|
end;
|
||||||
on_exit = function(code, signal)
|
on_exit = function(code, signal)
|
||||||
eq(0, code, "exit code", fake_lsp_logfile)
|
eq(0, code, "exit code")
|
||||||
eq(0, signal, "exit signal", fake_lsp_logfile)
|
eq(0, signal, "exit signal")
|
||||||
end;
|
end;
|
||||||
on_handler = function(err, result, ctx)
|
on_handler = function(err, result, ctx)
|
||||||
if ctx.method == 'start' then
|
if ctx.method == 'start' then
|
||||||
@ -960,8 +960,8 @@ describe('LSP', function()
|
|||||||
]]
|
]]
|
||||||
end;
|
end;
|
||||||
on_exit = function(code, signal)
|
on_exit = function(code, signal)
|
||||||
eq(0, code, "exit code", fake_lsp_logfile)
|
eq(0, code, "exit code")
|
||||||
eq(0, signal, "exit signal", fake_lsp_logfile)
|
eq(0, signal, "exit signal")
|
||||||
end;
|
end;
|
||||||
on_handler = function(err, result, ctx)
|
on_handler = function(err, result, ctx)
|
||||||
if ctx.method == 'start' then
|
if ctx.method == 'start' then
|
||||||
@ -1003,8 +1003,8 @@ describe('LSP', function()
|
|||||||
]]
|
]]
|
||||||
end;
|
end;
|
||||||
on_exit = function(code, signal)
|
on_exit = function(code, signal)
|
||||||
eq(0, code, "exit code", fake_lsp_logfile)
|
eq(0, code, "exit code")
|
||||||
eq(0, signal, "exit signal", fake_lsp_logfile)
|
eq(0, signal, "exit signal")
|
||||||
end;
|
end;
|
||||||
on_handler = function(err, result, ctx)
|
on_handler = function(err, result, ctx)
|
||||||
if ctx.method == 'start' then
|
if ctx.method == 'start' then
|
||||||
@ -1052,8 +1052,8 @@ describe('LSP', function()
|
|||||||
]]
|
]]
|
||||||
end;
|
end;
|
||||||
on_exit = function(code, signal)
|
on_exit = function(code, signal)
|
||||||
eq(0, code, "exit code", fake_lsp_logfile)
|
eq(0, code, "exit code")
|
||||||
eq(0, signal, "exit signal", fake_lsp_logfile)
|
eq(0, signal, "exit signal")
|
||||||
end;
|
end;
|
||||||
on_handler = function(err, result, ctx)
|
on_handler = function(err, result, ctx)
|
||||||
if ctx.method == 'start' then
|
if ctx.method == 'start' then
|
||||||
@ -1103,8 +1103,8 @@ describe('LSP', function()
|
|||||||
]]
|
]]
|
||||||
end;
|
end;
|
||||||
on_exit = function(code, signal)
|
on_exit = function(code, signal)
|
||||||
eq(0, code, "exit code", fake_lsp_logfile)
|
eq(0, code, "exit code")
|
||||||
eq(0, signal, "exit signal", fake_lsp_logfile)
|
eq(0, signal, "exit signal")
|
||||||
end;
|
end;
|
||||||
on_handler = function(err, result, ctx)
|
on_handler = function(err, result, ctx)
|
||||||
if ctx.method == 'start' then
|
if ctx.method == 'start' then
|
||||||
@ -1154,8 +1154,8 @@ describe('LSP', function()
|
|||||||
]]
|
]]
|
||||||
end;
|
end;
|
||||||
on_exit = function(code, signal)
|
on_exit = function(code, signal)
|
||||||
eq(0, code, "exit code", fake_lsp_logfile)
|
eq(0, code, "exit code")
|
||||||
eq(0, signal, "exit signal", fake_lsp_logfile)
|
eq(0, signal, "exit signal")
|
||||||
end;
|
end;
|
||||||
on_handler = function(err, result, ctx)
|
on_handler = function(err, result, ctx)
|
||||||
if ctx.method == 'start' then
|
if ctx.method == 'start' then
|
||||||
@ -1203,8 +1203,8 @@ describe('LSP', function()
|
|||||||
]]
|
]]
|
||||||
end;
|
end;
|
||||||
on_exit = function(code, signal)
|
on_exit = function(code, signal)
|
||||||
eq(0, code, "exit code", fake_lsp_logfile)
|
eq(0, code, "exit code")
|
||||||
eq(0, signal, "exit signal", fake_lsp_logfile)
|
eq(0, signal, "exit signal")
|
||||||
end;
|
end;
|
||||||
on_handler = function(err, result, ctx)
|
on_handler = function(err, result, ctx)
|
||||||
if ctx.method == 'start' then
|
if ctx.method == 'start' then
|
||||||
@ -1247,8 +1247,8 @@ describe('LSP', function()
|
|||||||
]]
|
]]
|
||||||
end;
|
end;
|
||||||
on_exit = function(code, signal)
|
on_exit = function(code, signal)
|
||||||
eq(0, code, "exit code", fake_lsp_logfile)
|
eq(0, code, "exit code")
|
||||||
eq(0, signal, "exit signal", fake_lsp_logfile)
|
eq(0, signal, "exit signal")
|
||||||
end;
|
end;
|
||||||
on_handler = function(err, result, ctx)
|
on_handler = function(err, result, ctx)
|
||||||
if ctx.method == 'start' then
|
if ctx.method == 'start' then
|
||||||
@ -1298,8 +1298,8 @@ describe('LSP', function()
|
|||||||
]]
|
]]
|
||||||
end;
|
end;
|
||||||
on_exit = function(code, signal)
|
on_exit = function(code, signal)
|
||||||
eq(0, code, "exit code", fake_lsp_logfile)
|
eq(0, code, "exit code")
|
||||||
eq(0, signal, "exit signal", fake_lsp_logfile)
|
eq(0, signal, "exit signal")
|
||||||
end;
|
end;
|
||||||
on_handler = function(err, result,ctx)
|
on_handler = function(err, result,ctx)
|
||||||
if ctx.method == 'start' then
|
if ctx.method == 'start' then
|
||||||
@ -1340,8 +1340,8 @@ describe('LSP', function()
|
|||||||
client.stop(true)
|
client.stop(true)
|
||||||
end;
|
end;
|
||||||
on_exit = function(code, signal)
|
on_exit = function(code, signal)
|
||||||
eq(0, code, "exit code", fake_lsp_logfile)
|
eq(0, code, "exit code")
|
||||||
eq(0, signal, "exit signal", fake_lsp_logfile)
|
eq(0, signal, "exit signal")
|
||||||
end;
|
end;
|
||||||
on_handler = function(err, result, ctx)
|
on_handler = function(err, result, ctx)
|
||||||
eq(table.remove(expected_handlers), {err, result, ctx}, "expected handler")
|
eq(table.remove(expected_handlers), {err, result, ctx}, "expected handler")
|
||||||
@ -1379,8 +1379,8 @@ describe('LSP', function()
|
|||||||
]]
|
]]
|
||||||
end;
|
end;
|
||||||
on_exit = function(code, signal)
|
on_exit = function(code, signal)
|
||||||
eq(0, code, "exit code", fake_lsp_logfile)
|
eq(0, code, "exit code")
|
||||||
eq(0, signal, "exit signal", fake_lsp_logfile)
|
eq(0, signal, "exit signal")
|
||||||
end;
|
end;
|
||||||
on_handler = function(err, result, ctx)
|
on_handler = function(err, result, ctx)
|
||||||
eq(table.remove(expected_handlers), {err, result, ctx}, "expected handler")
|
eq(table.remove(expected_handlers), {err, result, ctx}, "expected handler")
|
||||||
@ -1725,8 +1725,8 @@ describe('LSP', function()
|
|||||||
end;
|
end;
|
||||||
-- If the program timed out, then code will be nil.
|
-- If the program timed out, then code will be nil.
|
||||||
on_exit = function(code, signal)
|
on_exit = function(code, signal)
|
||||||
eq(0, code, "exit code", fake_lsp_logfile)
|
eq(0, code, "exit code")
|
||||||
eq(0, signal, "exit signal", fake_lsp_logfile)
|
eq(0, signal, "exit signal")
|
||||||
end;
|
end;
|
||||||
-- Note that NIL must be used here.
|
-- Note that NIL must be used here.
|
||||||
-- on_handler(err, method, result, client_id)
|
-- on_handler(err, method, result, client_id)
|
||||||
@ -2728,8 +2728,8 @@ describe('LSP', function()
|
|||||||
]=])
|
]=])
|
||||||
end;
|
end;
|
||||||
on_exit = function(code, signal)
|
on_exit = function(code, signal)
|
||||||
eq(0, code, "exit code", fake_lsp_logfile)
|
eq(0, code, "exit code")
|
||||||
eq(0, signal, "exit signal", fake_lsp_logfile)
|
eq(0, signal, "exit signal")
|
||||||
end;
|
end;
|
||||||
on_handler = function(err, result, ctx)
|
on_handler = function(err, result, ctx)
|
||||||
-- Don't compare & assert params, they're not relevant for the testcase
|
-- Don't compare & assert params, they're not relevant for the testcase
|
||||||
@ -2768,8 +2768,8 @@ describe('LSP', function()
|
|||||||
on_setup = function()
|
on_setup = function()
|
||||||
end,
|
end,
|
||||||
on_exit = function(code, signal)
|
on_exit = function(code, signal)
|
||||||
eq(0, code, "exit code", fake_lsp_logfile)
|
eq(0, code, "exit code")
|
||||||
eq(0, signal, "exit signal", fake_lsp_logfile)
|
eq(0, signal, "exit signal")
|
||||||
end,
|
end,
|
||||||
on_handler = function(err, result, ctx)
|
on_handler = function(err, result, ctx)
|
||||||
eq(table.remove(expected_handlers), {err, result, ctx})
|
eq(table.remove(expected_handlers), {err, result, ctx})
|
||||||
@ -2846,8 +2846,8 @@ describe('LSP', function()
|
|||||||
on_setup = function()
|
on_setup = function()
|
||||||
end,
|
end,
|
||||||
on_exit = function(code, signal)
|
on_exit = function(code, signal)
|
||||||
eq(0, code, "exit code", fake_lsp_logfile)
|
eq(0, code, "exit code")
|
||||||
eq(0, signal, "exit signal", fake_lsp_logfile)
|
eq(0, signal, "exit signal")
|
||||||
end,
|
end,
|
||||||
on_handler = function(err, result, ctx)
|
on_handler = function(err, result, ctx)
|
||||||
eq(table.remove(expected_handlers), {err, result, ctx})
|
eq(table.remove(expected_handlers), {err, result, ctx})
|
||||||
@ -2919,8 +2919,8 @@ describe('LSP', function()
|
|||||||
on_setup = function()
|
on_setup = function()
|
||||||
end,
|
end,
|
||||||
on_exit = function(code, signal)
|
on_exit = function(code, signal)
|
||||||
eq(0, code, "exit code", fake_lsp_logfile)
|
eq(0, code, "exit code")
|
||||||
eq(0, signal, "exit signal", fake_lsp_logfile)
|
eq(0, signal, "exit signal")
|
||||||
end,
|
end,
|
||||||
on_handler = function(err, result, ctx)
|
on_handler = function(err, result, ctx)
|
||||||
eq(table.remove(expected_handlers), {err, result, ctx})
|
eq(table.remove(expected_handlers), {err, result, ctx})
|
||||||
@ -2985,8 +2985,8 @@ describe('LSP', function()
|
|||||||
]=])
|
]=])
|
||||||
end,
|
end,
|
||||||
on_exit = function(code, signal)
|
on_exit = function(code, signal)
|
||||||
eq(0, code, "exit code", fake_lsp_logfile)
|
eq(0, code, "exit code")
|
||||||
eq(0, signal, "exit signal", fake_lsp_logfile)
|
eq(0, signal, "exit signal")
|
||||||
end,
|
end,
|
||||||
on_handler = function(err, result, ctx)
|
on_handler = function(err, result, ctx)
|
||||||
eq(table.remove(expected_handlers), {err, result, ctx})
|
eq(table.remove(expected_handlers), {err, result, ctx})
|
||||||
|
@ -51,42 +51,23 @@ local check_logs_useless_lines = {
|
|||||||
['See README_MISSING_SYSCALL_OR_IOCTL for guidance']=3,
|
['See README_MISSING_SYSCALL_OR_IOCTL for guidance']=3,
|
||||||
}
|
}
|
||||||
|
|
||||||
--- Invokes `fn` and includes the tail of `logfile` in the error message if it
|
function module.eq(expected, actual, context)
|
||||||
--- fails.
|
return assert.are.same(expected, actual, context)
|
||||||
---
|
|
||||||
---@param logfile string Log file, defaults to $NVIM_LOG_FILE or '.nvimlog'
|
|
||||||
---@param fn string Function to invoke
|
|
||||||
---@param ... string Function arguments
|
|
||||||
local function dumplog(logfile, fn, ...)
|
|
||||||
-- module.validate({
|
|
||||||
-- logfile={logfile,'s',true},
|
|
||||||
-- fn={fn,'f',false},
|
|
||||||
-- })
|
|
||||||
local status, rv = pcall(fn, ...)
|
|
||||||
if status == false then
|
|
||||||
logfile = logfile or os.getenv('NVIM_LOG_FILE') or '.nvimlog'
|
|
||||||
local logtail = module.read_nvim_log(logfile)
|
|
||||||
error(string.format('%s\n%s', tostring(rv), logtail))
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
function module.eq(expected, actual, context, logfile)
|
function module.neq(expected, actual, context)
|
||||||
return dumplog(logfile, assert.are.same, expected, actual, context)
|
return assert.are_not.same(expected, actual, context)
|
||||||
end
|
end
|
||||||
function module.neq(expected, actual, context, logfile)
|
function module.ok(res, msg)
|
||||||
return dumplog(logfile, assert.are_not.same, expected, actual, context)
|
return assert.is_true(res, msg)
|
||||||
end
|
|
||||||
function module.ok(res, msg, logfile)
|
|
||||||
return dumplog(logfile, assert.is_true, res, msg)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- TODO(bfredl): this should "failure" not "error" (issue with dumplog() )
|
|
||||||
local function epicfail(state, arguments, _)
|
local function epicfail(state, arguments, _)
|
||||||
state.failure_message = arguments[1]
|
state.failure_message = arguments[1]
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
assert:register("assertion", "epicfail", epicfail)
|
assert:register("assertion", "epicfail", epicfail)
|
||||||
function module.fail(msg, logfile)
|
function module.fail(msg)
|
||||||
return dumplog(logfile, assert.epicfail, msg)
|
return assert.epicfail(msg)
|
||||||
end
|
end
|
||||||
|
|
||||||
function module.matches(pat, actual)
|
function module.matches(pat, actual)
|
||||||
|
Loading…
Reference in New Issue
Block a user