neovim/test/old/testdir/test_ex_equal.vim
bfredl a92b38934a 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.
2023-03-22 09:10:04 +01:00

42 lines
788 B
VimL

" Test Ex := command.
func Test_ex_equal()
new
call setline(1, ["foo\tbar", "bar\tfoo"])
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)
let a = execute('=l')
call assert_equal("\n2\nfoo^Ibar$", a)
let a = execute('=p')
call assert_equal("\n2\nfoo bar", a)
let a = execute('=l#')
call assert_equal("\n2\n 1 foo^Ibar$", a)
let a = execute('=p#')
call assert_equal("\n2\n 1 foo bar", a)
call assert_fails('=x', 'E488:')
bwipe!
endfunc