diff src/testdir/test_lua.vim @ 20045:04ef2ccf2519 v8.2.0578

patch 8.2.0578: heredoc for interfaces does not support "trim" Commit: https://github.com/vim/vim/commit/6c2b7b8055b96463f78abb70f58c4c6d6d4b9d55 Author: Bram Moolenaar <Bram@vim.org> Date: Tue Apr 14 20:15:49 2020 +0200 patch 8.2.0578: heredoc for interfaces does not support "trim" Problem: Heredoc for interfaces does not support "trim". Solution: Update the script heredoc support to be same as the :let command. (Yegappan Lakshmanan, closes #5916)
author Bram Moolenaar <Bram@vim.org>
date Tue, 14 Apr 2020 20:30:05 +0200
parents 2a017e9dc6da
children 5f9c2c7d3d73
line wrap: on
line diff
--- a/src/testdir/test_lua.vim
+++ b/src/testdir/test_lua.vim
@@ -597,14 +597,33 @@ func Test_lua_set_cursor()
   new
   call setline(1, ['first line', 'second line'])
   normal gg
-  lua << EOF
-w = vim.window()
-w.line = 1
-w.col = 5
-EOF
+  lua << trim EOF
+    w = vim.window()
+    w.line = 1
+    w.col = 5
+  EOF
   call assert_equal([1, 5], [line('.'), col('.')])
 
   " Check that movement after setting cursor position keeps current column.
   normal j
   call assert_equal([2, 5], [line('.'), col('.')])
 endfunc
+
+" Test for various heredoc syntax
+func Test_lua_heredoc()
+  lua << END
+vim.command('let s = "A"')
+END
+  lua <<
+vim.command('let s ..= "B"')
+.
+  lua << trim END
+    vim.command('let s ..= "C"')
+  END
+  lua << trim
+    vim.command('let s ..= "D"')
+  .
+  call assert_equal('ABCD', s)
+endfunc
+
+" vim: shiftwidth=2 sts=2 expandtab