mirror of
https://github.com/neovim/neovim.git
synced 2025-11-05 18:24:22 +00:00
test: screen_setup(): Detect spawn failures, usage errors.
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
local helpers = require('test.functional.helpers')(nil)
|
local helpers = require('test.functional.helpers')(nil)
|
||||||
local Screen = require('test.functional.ui.screen')
|
local Screen = require('test.functional.ui.screen')
|
||||||
local nvim_dir = helpers.nvim_dir
|
local nvim_dir = helpers.nvim_dir
|
||||||
local execute, nvim, wait = helpers.execute, helpers.nvim, helpers.wait
|
local execute, nvim = helpers.execute, helpers.nvim
|
||||||
|
|
||||||
local function feed_data(data)
|
local function feed_data(data)
|
||||||
nvim('set_var', 'term_data', data)
|
nvim('set_var', 'term_data', data)
|
||||||
@@ -57,12 +57,19 @@ local function screen_setup(extra_rows, command, cols)
|
|||||||
})
|
})
|
||||||
|
|
||||||
screen:attach({rgb=false})
|
screen:attach({rgb=false})
|
||||||
-- tty-test puts the terminal into raw mode and echoes all input. tests are
|
|
||||||
-- done by feeding it with terminfo codes to control the display and
|
|
||||||
-- verifying output with screen:expect.
|
|
||||||
execute('enew | call termopen('..command..')')
|
execute('enew | call termopen('..command..')')
|
||||||
|
nvim('input', '<CR>')
|
||||||
|
local vim_errmsg = nvim('eval', 'v:errmsg')
|
||||||
|
if vim_errmsg and "" ~= vim_errmsg then
|
||||||
|
error(vim_errmsg)
|
||||||
|
end
|
||||||
|
|
||||||
execute('setlocal scrollback=10')
|
execute('setlocal scrollback=10')
|
||||||
execute('startinsert')
|
execute('startinsert')
|
||||||
|
|
||||||
|
-- tty-test puts the terminal into raw mode and echoes input. Tests work by
|
||||||
|
-- feeding termcodes to control the display and asserting by screen:expect.
|
||||||
if command == default_command then
|
if command == default_command then
|
||||||
-- Wait for "tty ready" to be printed before each test or the terminal may
|
-- Wait for "tty ready" to be printed before each test or the terminal may
|
||||||
-- still be in canonical mode (will echo characters for example).
|
-- still be in canonical mode (will echo characters for example).
|
||||||
@@ -82,7 +89,10 @@ local function screen_setup(extra_rows, command, cols)
|
|||||||
table.insert(expected, '{3:-- TERMINAL --}' .. ((' '):rep(cols - 13)))
|
table.insert(expected, '{3:-- TERMINAL --}' .. ((' '):rep(cols - 13)))
|
||||||
screen:expect(table.concat(expected, '\n'))
|
screen:expect(table.concat(expected, '\n'))
|
||||||
else
|
else
|
||||||
wait()
|
-- This eval also acts as a wait().
|
||||||
|
if 0 == nvim('eval', "exists('b:terminal_job_id')") then
|
||||||
|
error("terminal job failed to start")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
return screen
|
return screen
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -207,7 +207,9 @@ local function check_cores(app)
|
|||||||
out:write(('\nTests covered by this check: %u\n'):format(tests_skipped + 1))
|
out:write(('\nTests covered by this check: %u\n'):format(tests_skipped + 1))
|
||||||
end
|
end
|
||||||
tests_skipped = 0
|
tests_skipped = 0
|
||||||
assert(0 == found_cores)
|
if found_cores > 0 then
|
||||||
|
error("crash detected (see above)")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|||||||
Reference in New Issue
Block a user