mirror of
https://github.com/neovim/neovim.git
synced 2025-10-26 12:27:24 +00:00
Merge pull request #22743 from bfredl/luaequals
feat(lua): allow `:=expr` as a shorter version of `:lua =expr`
This commit is contained in:
@@ -146,6 +146,7 @@ describe(':lua command', function()
|
||||
it('prints result of =expr', function()
|
||||
exec_lua("x = 5")
|
||||
eq("5", exec_capture(':lua =x'))
|
||||
eq("5", exec_capture('=x'))
|
||||
exec_lua("function x() return 'hello' end")
|
||||
eq('hello', exec_capture(':lua = x()'))
|
||||
exec_lua("x = {a = 1, b = 2}")
|
||||
@@ -165,7 +166,7 @@ describe(':lua command', function()
|
||||
false
|
||||
nil
|
||||
Error message]],
|
||||
exec_capture(':lua =x(false)'))
|
||||
exec_capture('=x(false)'))
|
||||
end)
|
||||
end)
|
||||
|
||||
|
||||
@@ -7,6 +7,19 @@ func Test_ex_equal()
|
||||
let a = execute('=')
|
||||
call assert_equal("\n2", a)
|
||||
|
||||
let a = execute('.=')
|
||||
call assert_equal("\n1", a)
|
||||
|
||||
call assert_fails('3=', 'E16:')
|
||||
bwipe!
|
||||
endfunc
|
||||
|
||||
func Test_ex_equal_arg()
|
||||
throw 'skipped: Nvim evaluates lua with := [arg]'
|
||||
|
||||
new
|
||||
call setline(1, ["foo\tbar", "bar\tfoo"])
|
||||
|
||||
let a = execute('=#')
|
||||
call assert_equal("\n2\n 1 foo bar", a)
|
||||
|
||||
@@ -22,10 +35,6 @@ func Test_ex_equal()
|
||||
let a = execute('=p#')
|
||||
call assert_equal("\n2\n 1 foo bar", a)
|
||||
|
||||
let a = execute('.=')
|
||||
call assert_equal("\n1", a)
|
||||
|
||||
call assert_fails('3=', 'E16:')
|
||||
call assert_fails('=x', 'E488:')
|
||||
|
||||
bwipe!
|
||||
|
||||
Reference in New Issue
Block a user