diff options
author | zeertzjq <zeertzjq@outlook.com> | 2024-04-13 17:52:26 +0200 |
---|---|---|
committer | Christian Brabandt <cb@256bit.org> | 2024-04-13 17:52:26 +0200 |
commit | 1f5175d9af3d3f37e19f23e0e6f84caec47390f2 (patch) | |
tree | 2f1e6a3bdb9378b763d9990a6375fe1678cd8eac /src/testdir/test_let.vim | |
parent | e74cad3321ce1dcefc1fc64f617511275b6cd930 (diff) |
patch 9.1.0313: Crash when using heredoc with comment in command blockv9.1.0313
Problem: Crash when using heredoc with comment in command block.
Solution: Handle a newline more like the end of the line, fix coverity
warning (zeertzjq).
closes: #14535
Signed-off-by: zeertzjq <zeertzjq@outlook.com>
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.vim | 29 |
1 files changed, 24 insertions, 5 deletions
diff --git a/src/testdir/test_let.vim b/src/testdir/test_let.vim index e6d9cae8e5..974e8f1a37 100644 --- a/src/testdir/test_let.vim +++ b/src/testdir/test_let.vim @@ -536,6 +536,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 @@ -716,15 +723,27 @@ END 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")) + 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, "E990: Missing end marker ''") + 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') |