test: Fix hanging test suite after failures

When a test that fails leaves nvim in a 'Press Enter...' state, the whole suite
will hang because the `qa!` command executed before the next test won't be
processed until '<enter>' is sent.

Now the lua client can send a signal with when `Session:exit()` is called, so
the `qa!` request is no longer necessary.

Also:

- Set noswapfile at startup to prevent tests from leaving .s* swap files(should
  also improve test environment determinism)
- Use `assert(false, msg) instead of `error(msg)` to report screen assertion
  failures.
This commit is contained in:
Thiago de Arruda 2015-01-23 18:06:52 -03:00
parent c472e3af64
commit 41225fe4f6
2 changed files with 4 additions and 4 deletions

View File

@ -6,7 +6,8 @@ local Session = require('nvim.session')
local nvim_prog = os.getenv('NVIM_PROG') or 'build/bin/nvim'
local nvim_argv = {nvim_prog, '-u', 'NONE', '-i', 'NONE', '-N',
'--cmd', 'set shortmess+=I background=light', '--embed'}
'--cmd', 'set shortmess+=I background=light noswapfile',
'--embed'}
local prepend_argv
if os.getenv('VALGRIND') then
@ -153,8 +154,7 @@ end
local function clear()
if session then
session:request('vim_command', 'qa!')
session:exit()
session:exit(0)
end
local loop = Loop.new()
local msgpack_stream = MsgpackStream.new(loop)

View File

@ -192,7 +192,7 @@ function Screen:wait(check, timeout)
err = check()
end
if err then
error(err)
assert(false, err)
end
end