aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2023-05-05 19:03:08 +0800
committerzeertzjq <zeertzjq@outlook.com>2023-05-05 19:07:56 +0800
commit3a1e17e3a1767b4ff8a082150f7f9d6bda50cc8f (patch)
tree2483adbfb8e0bfffaaf5f31b52c94a1ce8f2266e
parent4a098b97e53551a3383e669f4730be542c61e012 (diff)
downloadrneovim-3a1e17e3a1767b4ff8a082150f7f9d6bda50cc8f.tar.gz
rneovim-3a1e17e3a1767b4ff8a082150f7f9d6bda50cc8f.tar.bz2
rneovim-3a1e17e3a1767b4ff8a082150f7f9d6bda50cc8f.zip
test: add tests for executing commands with backwards range
-rw-r--r--test/functional/api/vim_spec.lua6
-rw-r--r--test/functional/vimscript/execute_spec.lua9
2 files changed, 15 insertions, 0 deletions
diff --git a/test/functional/api/vim_spec.lua b/test/functional/api/vim_spec.lua
index af6fbf092a..c81b6e90cc 100644
--- a/test/functional/api/vim_spec.lua
+++ b/test/functional/api/vim_spec.lua
@@ -361,6 +361,12 @@ describe('API', function()
eq('', eval('v:errmsg')) -- v:errmsg was not updated.
eq('', eval('v:exception'))
end)
+
+ it('gives E493 instead of prompting on backwards range', function()
+ command('split')
+ eq('Vim(windo):E493: Backwards range given: 2,1windo echo',
+ pcall_err(command, '2,1windo echo'))
+ end)
end)
describe('nvim_command_output', function()
diff --git a/test/functional/vimscript/execute_spec.lua b/test/functional/vimscript/execute_spec.lua
index 17edf5c93e..a9a4ad4811 100644
--- a/test/functional/vimscript/execute_spec.lua
+++ b/test/functional/vimscript/execute_spec.lua
@@ -4,6 +4,7 @@ local eval = helpers.eval
local clear = helpers.clear
local source = helpers.source
local exc_exec = helpers.exc_exec
+local pcall_err = helpers.pcall_err
local funcs = helpers.funcs
local Screen = require('test.functional.ui.screen')
local command = helpers.command
@@ -284,6 +285,14 @@ describe('execute()', function()
eq('42', eval('g:mes'))
end)
+ it('gives E493 instead of prompting on backwards range for ""', function()
+ command('split')
+ eq('Vim(windo):E493: Backwards range given: 2,1windo echo',
+ pcall_err(funcs.execute, '2,1windo echo', ''))
+ eq('Vim(windo):E493: Backwards range given: 2,1windo echo',
+ pcall_err(funcs.execute, {'2,1windo echo'}, ''))
+ end)
+
it('captures but does not display output for "silent"', function()
local screen = Screen.new(40, 5)
screen:attach()