diff options
Diffstat (limited to 'test/old/testdir/test_let.vim')
-rw-r--r-- | test/old/testdir/test_let.vim | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/test/old/testdir/test_let.vim b/test/old/testdir/test_let.vim index 655c177385..da4334833b 100644 --- a/test/old/testdir/test_let.vim +++ b/test/old/testdir/test_let.vim @@ -542,6 +542,13 @@ END XX call assert_equal(['Line1'], var1) + let var1 =<< trim XX " comment + Line1 + Line2 + Line3 + XX + call assert_equal(['Line1', ' Line2', 'Line3'], var1) + " ignore "endfunc" let var1 =<< END something @@ -713,6 +720,32 @@ END LINES call CheckScriptFailure(lines, 'E15:') + " Test for using heredoc in a single string using execute() + call assert_equal("\n['one', 'two']", + \ execute("let x =<< trim END\n one\n two\nEND\necho x")) + call assert_equal("\n['one', ' two']", + \ execute("let x =<< trim END\n one\n two\nEND\necho x")) + call assert_equal("\n['one', 'two']", + \ execute(" let x =<< trim END\n one\n two\n END\necho x")) + call assert_equal("\n['one', ' two']", + \ execute(" let x =<< trim END\n one\n two\n END\necho x")) + call assert_equal("\n[' one', ' two']", + \ execute("let x =<< END\n one\n two\nEND\necho x")) + call assert_equal("\n['one', 'two']", + \ execute("let x =<< END\none\ntwo\nEND\necho x")) + call assert_equal("\n['one', 'two']", + \ execute("let x =<< END \" comment\none\ntwo\nEND\necho x")) + 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, "E172: Missing marker") + let cmd = 'execute("let x =<< trim\n one\n two\necho x")' + call assert_fails(cmd, "E172: Missing marker") + let cmd = 'execute("let x =<< end\n one\n two\nend\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 |