diff options
author | zeertzjq <zeertzjq@outlook.com> | 2024-04-09 21:47:10 +0200 |
---|---|---|
committer | Christian Brabandt <cb@256bit.org> | 2024-04-09 21:47:10 +0200 |
commit | 9a91d2b72c20f213bbf77f27b7edd01e0e43d5e0 (patch) | |
tree | a7eeb41a66f128f991990a2d5785684423306349 /src/testdir | |
parent | 1af0fbf955f799392f614bc38f9d2fcbd9960526 (diff) |
patch 9.1.0287: Vim9: comment may be treated as heredoc startv9.1.0287
Problem: Vim9: comment may be treated as heredoc start.
(Ernie Rael)
Solution: Use skip_var_list() instead of find_name_end().
(zeertzjq)
fixes: #14444
closes: #14446
Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Diffstat (limited to 'src/testdir')
-rw-r--r-- | src/testdir/test_let.vim | 52 | ||||
-rw-r--r-- | src/testdir/test_vim9_assign.vim | 11 |
2 files changed, 63 insertions, 0 deletions
diff --git a/src/testdir/test_let.vim b/src/testdir/test_let.vim index c99207c127..1d616350ba 100644 --- a/src/testdir/test_let.vim +++ b/src/testdir/test_let.vim @@ -396,6 +396,42 @@ func Test_let_heredoc_fails() call assert_report('Caught exception: ' .. v:exception) endtry + try + let @- =<< trim TEXT + change + insert + append + TEXT + call assert_report('No exception thrown') + catch /E730:/ + catch + call assert_report('Caught exception: ' .. v:exception) + endtry + + try + let [a b c] =<< trim TEXT + change + insert + append + TEXT + call assert_report('No exception thrown') + catch /E475:/ + catch + call assert_report('Caught exception: ' .. v:exception) + endtry + + try + let [a; b; c] =<< trim TEXT + change + insert + append + TEXT + call assert_report('No exception thrown') + catch /E452:/ + catch + call assert_report('Caught exception: ' .. v:exception) + endtry + let text =<< trim END func WrongSyntax() let v =<< that there @@ -571,6 +607,22 @@ append END call assert_equal(['change', 'insert', 'append'], [a, b, c]) + " unpack assignment with semicolon + let [a; b] =<< END +change +insert +append +END + call assert_equal(['change', ['insert', 'append']], [a, b]) + + " unpack assignment with registers + let [@/, @", @-] =<< END +change +insert +append +END + call assert_equal(['change', 'insert', 'append'], [@/, @", @-]) + " curly braces name and list slice assignment let foo_3_bar = ['', '', ''] let foo_{1 + 2}_bar[ : ] =<< END diff --git a/src/testdir/test_vim9_assign.vim b/src/testdir/test_vim9_assign.vim index 4414f55c06..82dc3e5ca9 100644 --- a/src/testdir/test_vim9_assign.vim +++ b/src/testdir/test_vim9_assign.vim @@ -1997,6 +1997,17 @@ def Test_heredoc() END v9.CheckScriptSuccess(lines) + # commented out heredoc assignment without space after '#' + lines =<< trim END + vim9script + def Func() + #x =<< trim [CODE] + #[CODE] + enddef + Func() + END + v9.CheckScriptSuccess(lines) + v9.CheckDefFailure(['var lines =<< trim END X', 'END'], 'E488:') v9.CheckDefFailure(['var lines =<< trim END " comment', 'END'], 'E488:') |