aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorbfredl <bjorn.linse@gmail.com>2023-03-20 21:11:10 +0100
committerbfredl <bjorn.linse@gmail.com>2023-03-22 09:10:04 +0100
commita92b38934a2d00c13ee4d1969d994da15e0857ab (patch)
treef201f6bb3718b4788403b986664e596f809d5a98 /test
parent4cba53e09e6e9d9cf06e87431146b9707347bcd6 (diff)
downloadrneovim-a92b38934a2d00c13ee4d1969d994da15e0857ab.tar.gz
rneovim-a92b38934a2d00c13ee4d1969d994da15e0857ab.tar.bz2
rneovim-a92b38934a2d00c13ee4d1969d994da15e0857ab.zip
feat(lua): allow `:=expr` as a shorter version of `:lua =expr`
existing behavior of := and :[range]= are unchanged. `|` is still allowed with this usage. However, :=p and similar are changed in a way which could be construed as a breaking change. Allowing |ex-flags| for := in the first place was a mistake as any form of := DOES NOT MOVE THE CURSOR. So it would print one line number and then print a completely different line contents after that.
Diffstat (limited to 'test')
-rw-r--r--test/functional/lua/commands_spec.lua3
-rw-r--r--test/old/testdir/test_ex_equal.vim17
2 files changed, 15 insertions, 5 deletions
diff --git a/test/functional/lua/commands_spec.lua b/test/functional/lua/commands_spec.lua
index 943095c51e..5bb9e0281b 100644
--- a/test/functional/lua/commands_spec.lua
+++ b/test/functional/lua/commands_spec.lua
@@ -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)
diff --git a/test/old/testdir/test_ex_equal.vim b/test/old/testdir/test_ex_equal.vim
index 05ad276836..32e23704eb 100644
--- a/test/old/testdir/test_ex_equal.vim
+++ b/test/old/testdir/test_ex_equal.vim
@@ -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!