aboutsummaryrefslogtreecommitdiff
path: root/test/functional/api/vim_spec.lua
diff options
context:
space:
mode:
Diffstat (limited to 'test/functional/api/vim_spec.lua')
-rw-r--r--test/functional/api/vim_spec.lua77
1 files changed, 74 insertions, 3 deletions
diff --git a/test/functional/api/vim_spec.lua b/test/functional/api/vim_spec.lua
index 9d5a0c4b4e..af6fbf092a 100644
--- a/test/functional/api/vim_spec.lua
+++ b/test/functional/api/vim_spec.lua
@@ -1,6 +1,5 @@
local helpers = require('test.functional.helpers')(after_each)
local Screen = require('test.functional.ui.screen')
-local lfs = require('lfs')
local luv = require('luv')
local fmt = string.format
@@ -2080,6 +2079,46 @@ describe('API', function()
end)
end)
+ describe('nvim_err_writeln', function()
+ local screen
+
+ before_each(function()
+ screen = Screen.new(40, 8)
+ screen:attach()
+ screen:set_default_attr_ids({
+ [0] = {bold=true, foreground=Screen.colors.Blue},
+ [1] = {foreground = Screen.colors.White, background = Screen.colors.Red},
+ [2] = {bold = true, foreground = Screen.colors.SeaGreen},
+ [3] = {bold = true, reverse = true},
+ })
+ end)
+
+ it('shows only one return prompt after all lines are shown', function()
+ nvim_async('err_writeln', 'FAILURE\nERROR\nEXCEPTION\nTRACEBACK')
+ screen:expect([[
+ |
+ {0:~ }|
+ {3: }|
+ {1:FAILURE} |
+ {1:ERROR} |
+ {1:EXCEPTION} |
+ {1:TRACEBACK} |
+ {2:Press ENTER or type command to continue}^ |
+ ]])
+ feed('<CR>')
+ screen:expect([[
+ ^ |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ |
+ ]])
+ end)
+ end)
+
describe('nvim_list_chans, nvim_get_chan_info', function()
before_each(function()
command('autocmd ChanOpen * let g:opened_event = deepcopy(v:event)')
@@ -3382,6 +3421,38 @@ describe('API', function()
'TextWithNoHighlight%#WarningMsg#TextWithWarningHighlight',
{ use_winbar = true, highlights = true }))
end)
+ it('works with statuscolumn', function()
+ exec([[
+ let &stc='%C%s%=%l '
+ set cul nu nuw=3 scl=yes:2 fdc=2
+ call setline(1, repeat(['aaaaa'], 5))
+ let g:ns = nvim_create_namespace('')
+ call sign_define('a', {'text':'aa', 'texthl':'IncSearch', 'numhl':'Normal'})
+ call sign_place(2, 1, 'a', bufnr(), {'lnum':4})
+ call nvim_buf_set_extmark(0, g:ns, 3, 1, { 'sign_text':'bb', 'sign_hl_group':'ErrorMsg' })
+ 1,5fold | 1,5 fold | foldopen!
+ norm 4G
+ ]])
+ eq({
+ str = '││aabb 4 ',
+ width = 9,
+ highlights = {
+ { group = 'CursorLineFold', start = 0 },
+ { group = 'Normal', start = 6 },
+ { group = 'IncSearch', start = 6 },
+ { group = 'ErrorMsg', start = 8 },
+ { group = 'Normal', start = 10 }
+ }
+ }, meths.eval_statusline('%C%s%=%l ', { use_statuscol_lnum = 4, highlights = true }))
+ eq({
+ str = '3 ' ,
+ width = 2,
+ highlights = {
+ { group = 'LineNr', start = 0 },
+ { group = 'ErrorMsg', start = 1 }
+ }
+ }, meths.eval_statusline('%l%#ErrorMsg# ', { use_statuscol_lnum = 3, highlights = true }))
+ end)
it('no memory leak with click functions', function()
meths.eval_statusline('%@ClickFunc@StatusLineStringWithClickFunc%T', {})
eq({
@@ -4140,7 +4211,7 @@ describe('API', function()
meths.cmd({ cmd = "buffers", mods = { filter = { pattern = "foo", force = true } } },
{ output = true }))
- -- with emsg_silent = true error is suppresed
+ -- with emsg_silent = true error is suppressed
feed([[:lua vim.api.nvim_cmd({ cmd = 'call', mods = { emsg_silent = true } }, {})<CR>]])
eq('', meths.cmd({ cmd = 'messages' }, { output = true }))
-- error from the next command typed is not suppressed #21420
@@ -4153,7 +4224,7 @@ describe('API', function()
vim.api.nvim_echo({{ opts.fargs[1] }}, false, {})
end, { nargs = 1 })
]])
- eq(lfs.currentdir(),
+ eq(luv.cwd(),
meths.cmd({ cmd = "Foo", args = { '%:p:h' }, magic = { file = true } },
{ output = true }))
end)