From c84bd9e21fb1e5c55c9c5370b07271a6ae96f19c Mon Sep 17 00:00:00 2001 From: Famiu Haque Date: Wed, 8 Jun 2022 09:06:36 +0600 Subject: fix(nvim_create_user_command): make `smods` work with `nvim_cmd` Closes #18876. --- test/functional/api/command_spec.lua | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) (limited to 'test/functional/api/command_spec.lua') diff --git a/test/functional/api/command_spec.lua b/test/functional/api/command_spec.lua index 253371557a..a9ec2b6541 100644 --- a/test/functional/api/command_spec.lua +++ b/test/functional/api/command_spec.lua @@ -136,7 +136,7 @@ describe('nvim_create_user_command', function() silent = false, split = "", tab = 0, - verbose = 0, + verbose = -1, vertical = false, }, range = 0, @@ -170,7 +170,7 @@ describe('nvim_create_user_command', function() silent = false, split = "", tab = 0, - verbose = 0, + verbose = -1, vertical = false, }, range = 0, @@ -204,7 +204,7 @@ describe('nvim_create_user_command', function() silent = false, split = "", tab = 0, - verbose = 0, + verbose = -1, vertical = false, }, range = 0, @@ -238,7 +238,7 @@ describe('nvim_create_user_command', function() silent = false, split = "botright", tab = 0, - verbose = 0, + verbose = -1, vertical = false, }, range = 1, @@ -272,7 +272,7 @@ describe('nvim_create_user_command', function() silent = false, split = "", tab = 0, - verbose = 0, + verbose = -1, vertical = false, }, range = 1, @@ -306,7 +306,7 @@ describe('nvim_create_user_command', function() silent = false, split = "", tab = 0, - verbose = 0, + verbose = -1, vertical = false, }, range = 0, @@ -352,7 +352,7 @@ describe('nvim_create_user_command', function() silent = false, split = "", tab = 0, - verbose = 0, + verbose = -1, vertical = false, }, range = 0, @@ -418,6 +418,16 @@ describe('nvim_create_user_command', function() vim.api.nvim_create_user_command('💩', 'echo "hi"', {}) ]])) end) + + it('smods can be used with nvim_cmd', function() + exec_lua[[ + vim.api.nvim_create_user_command('MyEcho', function(opts) + vim.api.nvim_cmd({ cmd = 'echo', args = { '&verbose' }, mods = opts.smods }, {}) + end, {}) + ]] + + eq("3", meths.cmd({ cmd = 'MyEcho', mods = { verbose = 3 } }, { output = true })) + end) end) describe('nvim_del_user_command', function() -- cgit