aboutsummaryrefslogtreecommitdiff
path: root/test/functional/api/command_spec.lua
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-09-28 18:27:59 +0800
committerGitHub <noreply@github.com>2022-09-28 18:27:59 +0800
commit35e2c4a2edd28f72c48c70530c5486365c2502a4 (patch)
treeec54859fafa670fb1b5b8d2801d1a5e0ee5d2e96 /test/functional/api/command_spec.lua
parenteb4844b5ed9bcf8c434a93b9f9def4fe81557f37 (diff)
downloadrneovim-35e2c4a2edd28f72c48c70530c5486365c2502a4.tar.gz
rneovim-35e2c4a2edd28f72c48c70530c5486365c2502a4.tar.bz2
rneovim-35e2c4a2edd28f72c48c70530c5486365c2502a4.zip
fix(lua): fix architecture-dependent behavior in usercmd "reg" (#20384)
I don't think using an integer as a NUL-terminated string can work on big-endian systems, at least. This is also not tested. Add a test. Also fix a mistake in the docs of nvim_parse_cmd.
Diffstat (limited to 'test/functional/api/command_spec.lua')
-rw-r--r--test/functional/api/command_spec.lua37
1 files changed, 37 insertions, 0 deletions
diff --git a/test/functional/api/command_spec.lua b/test/functional/api/command_spec.lua
index 44a19d8348..f19d7a362b 100644
--- a/test/functional/api/command_spec.lua
+++ b/test/functional/api/command_spec.lua
@@ -423,6 +423,7 @@ describe('nvim_create_user_command', function()
nargs = 0,
bang = true,
count = 2,
+ register = true,
})
]]
eq({
@@ -460,6 +461,42 @@ describe('nvim_create_user_command', function()
vim.cmd('CommandWithNoArgs')
return result
]])
+ -- register can be specified
+ eq({
+ args = "",
+ fargs = {},
+ bang = false,
+ line1 = 1,
+ line2 = 1,
+ mods = "",
+ smods = {
+ browse = false,
+ confirm = false,
+ emsg_silent = false,
+ hide = false,
+ horizontal = false,
+ keepalt = false,
+ keepjumps = false,
+ keepmarks = false,
+ keeppatterns = false,
+ lockmarks = false,
+ noautocmd = false,
+ noswapfile = false,
+ sandbox = false,
+ silent = false,
+ split = "",
+ tab = -1,
+ unsilent = false,
+ verbose = -1,
+ vertical = false,
+ },
+ range = 0,
+ count = 2,
+ reg = "+",
+ }, exec_lua [[
+ vim.cmd('CommandWithNoArgs +')
+ return result
+ ]])
end)