summaryrefslogtreecommitdiffstats
path: root/src/testdir/test_let.vim
diff options
context:
space:
mode:
authorYegappan Lakshmanan <yegappan@yahoo.com>2024-04-12 18:48:35 +0200
committerChristian Brabandt <cb@256bit.org>2024-04-12 18:53:08 +0200
commite74cad3321ce1dcefc1fc64f617511275b6cd930 (patch)
treeb29c4a7843c748750a448800846bbff1b1dfde19 /src/testdir/test_let.vim
parenta1dcd76ce791b5b8bd093765a99b71aa163300a5 (diff)
patch 9.1.0312: heredocs are not supported for :commandsv9.1.0312
Problem: heredocs are not supported for :commands (@balki) Solution: Add heredoc support (Yegappan Lakshmanan) fixes: #14491 closes: #14528 Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
Diffstat (limited to 'src/testdir/test_let.vim')
-rw-r--r--src/testdir/test_let.vim14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/testdir/test_let.vim b/src/testdir/test_let.vim
index 5ee2e9b3c4..e6d9cae8e5 100644
--- a/src/testdir/test_let.vim
+++ b/src/testdir/test_let.vim
@@ -715,6 +715,20 @@ END
LINES
call v9.CheckScriptFailure(lines, 'E15:')
+ " Test for using heredoc in a single string using execute()
+ call assert_equal(["['one', 'two']"],
+ \ execute("let x =<< trim END\n one\n two\nEND\necho x")->split("\n"))
+ call assert_equal(["[' one', ' two']"],
+ \ execute("let x =<< END\n one\n two\nEND\necho x")->split("\n"))
+ let cmd = 'execute("let x =<< END\n one\n two\necho x")'
+ call assert_fails(cmd, "E990: Missing end marker 'END'")
+ let cmd = 'execute("let x =<<\n one\n two\necho x")'
+ call assert_fails(cmd, "E990: Missing end marker ''")
+ let cmd = 'execute("let x =<< trim\n one\n two\necho x")'
+ call assert_fails(cmd, "E221: Marker cannot start with lower case letter")
+ let cmd = 'execute("let x =<< eval END\n one\n two{y}\nEND\necho x")'
+ call assert_fails(cmd, 'E121: Undefined variable: y')
+
" skipped heredoc
if 0
let msg =<< trim eval END