From 493d250446e5323e64c80399f0c5a15621c4f15c Mon Sep 17 00:00:00 2001 From: ZyX Date: Wed, 28 Jun 2017 13:58:51 +0300 Subject: functests: Make “stops executing callback” test work MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Needed to be adjusted to use input() (previously relied on side-effects of executing `:cmd`) and dismiss something (hidden “Press ENTER” message?). --- test/functional/ui/cmdline_highlight_spec.lua | 30 +++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) (limited to 'test') diff --git a/test/functional/ui/cmdline_highlight_spec.lua b/test/functional/ui/cmdline_highlight_spec.lua index 6bb06b2ed3..12577a4db4 100644 --- a/test/functional/ui/cmdline_highlight_spec.lua +++ b/test/functional/ui/cmdline_highlight_spec.lua @@ -24,8 +24,9 @@ before_each(function() redraw! return '' endfunction + let g:EMPTY = '' cnoremap {REDRAW} Redraw() - nnoremap {PROMPT} input({"prompt": ":", "highlight": g:Nvim_color_input})[1:0] + nnoremap {PROMPT} extend(g:, {"out": input({"prompt": ":", "highlight": g:Nvim_color_input})}).EMPTY function RainBowParens(cmdline) let ret = [] let i = 0 @@ -295,13 +296,34 @@ describe('Command-line coloring', function() start_prompt('e') -- FIXME Does not work well with :throw: error message overwrites cmdline. end) - pending('stops executing callback after a number of errors'--[[, function() + it('stops executing callback after a number of errors', function() set_color_cb('SplittedMultibyteStart') start_prompt('let x = "«»«»«»«»«»"\n') - eq('«»«»«»«»«»', meths.get_var('x')) + screen:expect([[ + {EOB:~ }| + {EOB:~ }| + {EOB:~ }| + {EOB:~ }| + :let x = " | + {ERR:E5405: Chunk 0 start 10 splits multibyte}| + {ERR: character} | + ^:let x = "«»«»«»«»«»" | + ]]) + feed('\n') + screen:expect([[ + ^ | + {EOB:~ }| + {EOB:~ }| + {EOB:~ }| + {EOB:~ }| + {EOB:~ }| + {EOB:~ }| + | + ]]) + eq('let x = "«»«»«»«»«»"', meths.get_var('out')) local msg = '\nE5405: Chunk 0 start 10 splits multibyte character' eq(msg:rep(1), funcs.execute('messages')) - end]]) + end) it('allows interrupting callback with ', function() if true then return pending(' does not work well enough now') end set_color_cb('Halting') -- cgit