diff options
Diffstat (limited to 'test/functional/api')
-rw-r--r-- | test/functional/api/extmark_spec.lua | 38 | ||||
-rw-r--r-- | test/functional/api/keymap_spec.lua | 51 |
2 files changed, 89 insertions, 0 deletions
diff --git a/test/functional/api/extmark_spec.lua b/test/functional/api/extmark_spec.lua index 54f4aaab03..cb16f49e7c 100644 --- a/test/functional/api/extmark_spec.lua +++ b/test/functional/api/extmark_spec.lua @@ -1639,6 +1639,40 @@ describe('API/extmarks', function() right_gravity = true, }, }, get_extmark_by_id(ns, marks[3], { details = true })) + set_extmark(ns, marks[4], 0, 0, { + end_col = 1, + conceal = 'a', + spell = true, + }) + eq({ + 0, + 0, + { + conceal = 'a', + end_col = 1, + end_right_gravity = false, + end_row = 0, + ns_id = 1, + right_gravity = true, + spell = true, + }, + }, get_extmark_by_id(ns, marks[4], { details = true })) + set_extmark(ns, marks[5], 0, 0, { + end_col = 1, + spell = false, + }) + eq({ + 0, + 0, + { + end_col = 1, + end_right_gravity = false, + end_row = 0, + ns_id = 1, + right_gravity = true, + spell = false, + }, + }, get_extmark_by_id(ns, marks[5], { details = true })) api.nvim_buf_clear_namespace(0, ns, 0, -1) -- legacy sign mark includes sign name command('sign define sign1 text=s1 texthl=Title linehl=LineNR numhl=Normal culhl=CursorLine') @@ -1712,6 +1746,10 @@ describe('API/extmarks', function() aaa bbb ccc |*2 | ]]) + -- decor is not removed twice + command('d3') + api.nvim_buf_del_extmark(0, ns, 1) + command('silent undo') -- mark is deleted with undo_restore == false set_extmark(ns, 1, 0, 0, { invalidate = true, undo_restore = false, sign_text = 'S1' }) set_extmark(ns, 2, 1, 0, { invalidate = true, undo_restore = false, sign_text = 'S2' }) diff --git a/test/functional/api/keymap_spec.lua b/test/functional/api/keymap_spec.lua index 4f57f6d0bd..0decd710e9 100644 --- a/test/functional/api/keymap_spec.lua +++ b/test/functional/api/keymap_spec.lua @@ -460,6 +460,57 @@ describe('nvim_get_keymap', function() desc = 'map description', }, api.nvim_get_keymap('n')[1]) end) + + it('can get abbreviations', function() + command('inoreabbr foo bar') + command('cnoreabbr <buffer> foo baz') + + local mapargs_i = { + abbr = 1, + buffer = 0, + expr = 0, + lhs = 'foo', + lhsraw = 'foo', + lnum = 0, + mode = 'i', + mode_bits = 0x10, + noremap = 1, + nowait = 0, + rhs = 'bar', + script = 0, + scriptversion = 1, + sid = 0, + silent = 0, + } + local mapargs_c = { + abbr = 1, + buffer = 1, + expr = 0, + lhs = 'foo', + lhsraw = 'foo', + lnum = 0, + mode = 'c', + mode_bits = 0x08, + noremap = 1, + nowait = 0, + rhs = 'baz', + script = 0, + scriptversion = 1, + sid = 0, + silent = 0, + } + + local curbuf = api.nvim_get_current_buf() + + eq({ mapargs_i }, api.nvim_get_keymap('ia')) + eq({}, api.nvim_buf_get_keymap(curbuf, 'ia')) + + eq({}, api.nvim_get_keymap('ca')) + eq({ mapargs_c }, api.nvim_buf_get_keymap(curbuf, 'ca')) + + eq({ mapargs_i }, api.nvim_get_keymap('!a')) + eq({ mapargs_c }, api.nvim_buf_get_keymap(curbuf, '!a')) + end) end) describe('nvim_set_keymap, nvim_del_keymap', function() |