aboutsummaryrefslogtreecommitdiff
path: root/test/functional/lua/commands_spec.lua
diff options
context:
space:
mode:
Diffstat (limited to 'test/functional/lua/commands_spec.lua')
-rw-r--r--test/functional/lua/commands_spec.lua25
1 files changed, 25 insertions, 0 deletions
diff --git a/test/functional/lua/commands_spec.lua b/test/functional/lua/commands_spec.lua
index 28a99a86f8..083f6f3541 100644
--- a/test/functional/lua/commands_spec.lua
+++ b/test/functional/lua/commands_spec.lua
@@ -55,6 +55,12 @@ describe(':lua command', function()
)
end)
it('throws catchable errors', function()
+ for _, cmd in ipairs({ 'lua', '1lua chunk' }) do
+ eq(
+ 'Vim(lua):E475: Invalid argument: exactly one of {chunk} and {range} required',
+ pcall_err(command, cmd)
+ )
+ end
eq(
[[Vim(lua):E5107: Error loading lua [string ":lua"]:0: unexpected symbol near ')']],
pcall_err(command, 'lua ()')
@@ -192,6 +198,25 @@ describe(':lua command', function()
exec_capture('=x(false)')
)
end)
+
+ it('works with range in current buffer', function()
+ local screen = Screen.new(40, 10)
+ screen:attach()
+ api.nvim_buf_set_lines(0, 0, 0, 0, { 'function x() print "hello" end', 'x()' })
+ feed(':1,2lua<CR>')
+ screen:expect {
+ grid = [[
+ function x() print "hello" end |
+ x() |
+ ^ |
+ {1:~ }|*6
+ hello |
+ ]],
+ attr_ids = {
+ [1] = { foreground = Screen.colors.Blue, bold = true },
+ },
+ }
+ end)
end)
describe(':luado command', function()