aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/functional/api/vim_spec.lua12
-rw-r--r--test/functional/lua/vim_spec.lua2
-rw-r--r--test/functional/terminal/mouse_spec.lua30
3 files changed, 42 insertions, 2 deletions
diff --git a/test/functional/api/vim_spec.lua b/test/functional/api/vim_spec.lua
index 5677990525..531b9cc2c1 100644
--- a/test/functional/api/vim_spec.lua
+++ b/test/functional/api/vim_spec.lua
@@ -3853,14 +3853,16 @@ describe('API', function()
eq("", meths.cmd({ cmd = "Foo", bang = false }, { output = true }))
end)
it('works with modifiers', function()
- -- with :silent output is still captured
+ -- with silent = true output is still captured
eq('1',
meths.cmd({ cmd = 'echomsg', args = { '1' }, mods = { silent = true } },
{ output = true }))
-- but message isn't added to message history
eq('', meths.cmd({ cmd = 'messages' }, { output = true }))
+
meths.create_user_command("Foo", 'set verbose', {})
eq(" verbose=1", meths.cmd({ cmd = "Foo", mods = { verbose = 1 } }, { output = true }))
+
meths.create_user_command("Mods", "echo '<mods>'", {})
eq('keepmarks keeppatterns silent 3verbose aboveleft horizontal',
meths.cmd({ cmd = "Mods", mods = {
@@ -3872,6 +3874,7 @@ describe('API', function()
verbose = 3,
} }, { output = true }))
eq(0, meths.get_option_value("verbose", {}))
+
command('edit foo.txt | edit bar.txt')
eq(' 1 #h "foo.txt" line 1',
meths.cmd({ cmd = "buffers", mods = { filter = { pattern = "foo", force = false } } },
@@ -3879,6 +3882,13 @@ describe('API', function()
eq(' 2 %a "bar.txt" line 1',
meths.cmd({ cmd = "buffers", mods = { filter = { pattern = "foo", force = true } } },
{ output = true }))
+
+ -- with emsg_silent = true error is suppresed
+ 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
+ feed(':call<CR><CR>')
+ eq('E471: Argument required', meths.cmd({ cmd = 'messages' }, { output = true }))
end)
it('works with magic.file', function()
exec_lua([[
diff --git a/test/functional/lua/vim_spec.lua b/test/functional/lua/vim_spec.lua
index e390619a5a..90eccc49c8 100644
--- a/test/functional/lua/vim_spec.lua
+++ b/test/functional/lua/vim_spec.lua
@@ -512,6 +512,8 @@ describe('lua stdlib', function()
eq(NIL, exec_lua("return vim.tbl_get({ unindexable = function () end }, 'unindexable', 'missing_key')"))
eq(NIL, exec_lua("return vim.tbl_get({}, 'missing_key')"))
eq(NIL, exec_lua("return vim.tbl_get({})"))
+ eq(1, exec_lua("return select('#', vim.tbl_get({}))"))
+ eq(1, exec_lua("return select('#', vim.tbl_get({ nested = {} }, 'nested', 'missing_key'))"))
end)
it('vim.tbl_extend', function()
diff --git a/test/functional/terminal/mouse_spec.lua b/test/functional/terminal/mouse_spec.lua
index 899df0ac54..50c8f5e7df 100644
--- a/test/functional/terminal/mouse_spec.lua
+++ b/test/functional/terminal/mouse_spec.lua
@@ -289,7 +289,7 @@ describe(':terminal mouse', function()
]])
end)
- it('wont lose focus if another window is scrolled', function()
+ it("won't lose focus if another window is scrolled", function()
feed('<ScrollWheelUp><4,0><ScrollWheelUp><4,0>')
screen:expect([[
{7: 21 }line │line30 |
@@ -312,6 +312,34 @@ describe(':terminal mouse', function()
]])
end)
+ it("scrolling another window respects 'mousescroll'", function()
+ command('set mousescroll=ver:1')
+ feed('<ScrollWheelUp><4,0>')
+ screen:expect([[
+ {7: 26 }line │line30 |
+ {7: 27 }line │rows: 5, cols: 25 |
+ {7: 28 }line │rows: 5, cols: 24 |
+ {7: 29 }line │mouse enabled |
+ {7: 30 }line │{1: } |
+ ========== ========== |
+ {3:-- TERMINAL --} |
+ ]])
+ command('set mousescroll=ver:10')
+ feed('<ScrollWheelUp><4,0>')
+ screen:expect([[
+ {7: 16 }line │line30 |
+ {7: 17 }line │rows: 5, cols: 25 |
+ {7: 18 }line │rows: 5, cols: 24 |
+ {7: 19 }line │mouse enabled |
+ {7: 20 }line │{1: } |
+ ========== ========== |
+ {3:-- TERMINAL --} |
+ ]])
+ command('set mousescroll=ver:0')
+ feed('<ScrollWheelUp><4,0>')
+ screen:expect_unchanged()
+ end)
+
it('will lose focus if another window is clicked', function()
feed('<LeftMouse><5,1>')
screen:expect([[