aboutsummaryrefslogtreecommitdiff
path: root/test/functional/ui/cmdline_highlight_spec.lua
diff options
context:
space:
mode:
authorZyX <kp-pav@yandex.ru>2017-06-28 13:58:51 +0300
committerZyX <kp-pav@yandex.ru>2017-06-28 13:58:51 +0300
commit493d250446e5323e64c80399f0c5a15621c4f15c (patch)
treec324d888f7ade83d337a9244e2ecf30cd7de34cc /test/functional/ui/cmdline_highlight_spec.lua
parent36a84d8f4ab104050e6ec52da9ca6e10f9361a0c (diff)
downloadrneovim-493d250446e5323e64c80399f0c5a15621c4f15c.tar.gz
rneovim-493d250446e5323e64c80399f0c5a15621c4f15c.tar.bz2
rneovim-493d250446e5323e64c80399f0c5a15621c4f15c.zip
functests: Make “stops executing callback” test work
Needed to be adjusted to use input() (previously relied on side-effects of executing `:cmd`) and dismiss something (hidden “Press ENTER” message?).
Diffstat (limited to 'test/functional/ui/cmdline_highlight_spec.lua')
-rw-r--r--test/functional/ui/cmdline_highlight_spec.lua30
1 files changed, 26 insertions, 4 deletions
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 <expr> {REDRAW} Redraw()
- nnoremap <expr> {PROMPT} input({"prompt": ":", "highlight": g:Nvim_color_input})[1:0]
+ nnoremap <expr> {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 <C-c>', function()
if true then return pending('<C-c> does not work well enough now') end
set_color_cb('Halting')