aboutsummaryrefslogtreecommitdiff
path: root/test/functional/ex_cmds/excmd_spec.lua
diff options
context:
space:
mode:
authorJosh Rahm <joshuarahm@gmail.com>2023-11-29 21:52:58 +0000
committerJosh Rahm <joshuarahm@gmail.com>2023-11-29 21:52:58 +0000
commit931bffbda3668ddc609fc1da8f9eb576b170aa52 (patch)
treed8c1843a95da5ea0bb4acc09f7e37843d9995c86 /test/functional/ex_cmds/excmd_spec.lua
parent142d9041391780ac15b89886a54015fdc5c73995 (diff)
parent4a8bf24ac690004aedf5540fa440e788459e5e34 (diff)
downloadrneovim-userreg.tar.gz
rneovim-userreg.tar.bz2
rneovim-userreg.zip
Merge remote-tracking branch 'upstream/master' into userreguserreg
Diffstat (limited to 'test/functional/ex_cmds/excmd_spec.lua')
-rw-r--r--test/functional/ex_cmds/excmd_spec.lua37
1 files changed, 30 insertions, 7 deletions
diff --git a/test/functional/ex_cmds/excmd_spec.lua b/test/functional/ex_cmds/excmd_spec.lua
index e243f3c524..a92329ede5 100644
--- a/test/functional/ex_cmds/excmd_spec.lua
+++ b/test/functional/ex_cmds/excmd_spec.lua
@@ -2,6 +2,7 @@ local helpers = require("test.functional.helpers")(after_each)
local command = helpers.command
local eq = helpers.eq
local clear = helpers.clear
+local funcs = helpers.funcs
local pcall_err = helpers.pcall_err
local assert_alive = helpers.assert_alive
@@ -10,21 +11,43 @@ describe('Ex cmds', function()
clear()
end)
+ local function check_excmd_err(cmd, err)
+ eq(err .. ': ' .. cmd, pcall_err(command, cmd))
+ end
+
it('handle integer overflow from user-input #5555', function()
command(':9999999999999999999999999999999999999999')
command(':later 9999999999999999999999999999999999999999')
command(':echo expand("#<9999999999999999999999999999999999999999")')
command(':lockvar 9999999999999999999999999999999999999999')
command(':winsize 9999999999999999999999999999999999999999 9999999999999999999999999999999999999999')
- eq('Vim(tabnext):E475: Invalid argument: 9999999999999999999999999999999999999999',
- pcall_err(command, ':tabnext 9999999999999999999999999999999999999999'))
- eq('Vim(Next):E939: Positive count required',
- pcall_err(command, ':N 9999999999999999999999999999999999999999'))
+ check_excmd_err(':tabnext 9999999999999999999999999999999999999999',
+ 'Vim(tabnext):E475: Invalid argument: 9999999999999999999999999999999999999999')
+ check_excmd_err(':N 9999999999999999999999999999999999999999',
+ 'Vim(Next):E939: Positive count required')
+ check_excmd_err(':bdelete 9999999999999999999999999999999999999999',
+ 'Vim(bdelete):E939: Positive count required')
eq('Vim(menu):E329: No menu "9999999999999999999999999999999999999999"',
pcall_err(command, ':menu 9999999999999999999999999999999999999999'))
- eq('Vim(bdelete):E939: Positive count required',
- pcall_err(command, ':bdelete 9999999999999999999999999999999999999999'))
assert_alive()
end)
-end)
+ it('listing long user command does not crash', function()
+ command('execute "command" repeat("T", 255) ":"')
+ command('command')
+ end)
+
+ it(':def is an unknown command #23149', function()
+ eq('Vim:E492: Not an editor command: def', pcall_err(command, 'def'))
+ eq(1, funcs.exists(':d'))
+ eq('delete', funcs.fullcommand('d'))
+ eq(1, funcs.exists(':de'))
+ eq('delete', funcs.fullcommand('de'))
+ eq(0, funcs.exists(':def'))
+ eq('', funcs.fullcommand('def'))
+ eq(1, funcs.exists(':defe'))
+ eq('defer', funcs.fullcommand('defe'))
+ eq(2, funcs.exists(':defer'))
+ eq('defer', funcs.fullcommand('defer'))
+ end)
+end)