diff options
| author | zeertzjq <zeertzjq@outlook.com> | 2025-02-04 07:44:41 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-02-04 07:44:41 +0800 |
| commit | 5a7cf85c2c7e452563a4bce9195e9a3426ca3050 (patch) | |
| tree | 30cdcbbc5a326f4ac1207ee5d44c9f91abf59cd7 /test | |
| parent | f618cdf9c41fd977df89f809e6adb040522f675b (diff) | |
| download | rneovim-5a7cf85c2c7e452563a4bce9195e9a3426ca3050.tar.gz rneovim-5a7cf85c2c7e452563a4bce9195e9a3426ca3050.tar.bz2 rneovim-5a7cf85c2c7e452563a4bce9195e9a3426ca3050.zip | |
vim-patch:9.1.1074: Strange error when heredoc marker starts with "trim" (#32317)
Problem: Strange error when heredoc marker starts with "trim".
Solution: Check for whitespace after "trim" or "eval" (zeertzjq)
For :python3 etc., a heredoc marker that starts with a lower-case letter
is valid, and when it starts with "trim" it works in a script but not in
a function, and this PR makes it works in a function.
For :let, a heredoc marker that starts with a lower-case letter is not
valid, but when it starts with "trim" or "eval" the error can be a bit
confusing in a function, and this PR make it less confusing.
closes: vim/vim#16574
https://github.com/vim/vim/commit/449c2e5454735fe1cfc8c21b2c6880d6bdf4cd6e
Diffstat (limited to 'test')
| -rw-r--r-- | test/old/testdir/test_let.vim | 18 | ||||
| -rw-r--r-- | test/old/testdir/test_perl.vim | 5 | ||||
| -rw-r--r-- | test/old/testdir/test_python3.vim | 5 | ||||
| -rw-r--r-- | test/old/testdir/test_pyx3.vim | 5 | ||||
| -rw-r--r-- | test/old/testdir/test_ruby.vim | 5 |
5 files changed, 34 insertions, 4 deletions
diff --git a/test/old/testdir/test_let.vim b/test/old/testdir/test_let.vim index 44852c1d38..22a3a35f87 100644 --- a/test/old/testdir/test_let.vim +++ b/test/old/testdir/test_let.vim @@ -436,6 +436,24 @@ func Test_let_heredoc_fails() call assert_report('Caught exception: ' .. v:exception) endtry + try + let v =<< trim trimm + trimm + call assert_report('No exception thrown') + catch /E221:/ + catch + call assert_report('Caught exception: ' .. v:exception) + endtry + + try + let v =<< trim trim evall + evall + call assert_report('No exception thrown') + catch /E221:/ + catch + call assert_report('Caught exception: ' .. v:exception) + endtry + let text =<< trim END func WrongSyntax() let v =<< that there diff --git a/test/old/testdir/test_perl.vim b/test/old/testdir/test_perl.vim index c08a042dae..2d7f8fdc10 100644 --- a/test/old/testdir/test_perl.vim +++ b/test/old/testdir/test_perl.vim @@ -316,7 +316,10 @@ VIM::DoCommand('let s ..= "B"') perl << trim eof VIM::DoCommand('let s ..= "E"') eof - call assert_equal('ABCDE', s) + perl << trimm +VIM::DoCommand('let s ..= "F"') +trimm + call assert_equal('ABCDEF', s) endfunc " vim: shiftwidth=2 sts=2 expandtab diff --git a/test/old/testdir/test_python3.vim b/test/old/testdir/test_python3.vim index c9dbc0b84e..2436587100 100644 --- a/test/old/testdir/test_python3.vim +++ b/test/old/testdir/test_python3.vim @@ -284,7 +284,10 @@ s+='B' python3 << trim eof s+='E' eof - call assert_equal('ABCDE', pyxeval('s')) + python3 << trimm +s+='F' +trimm + call assert_equal('ABCDEF', pyxeval('s')) endfunc " vim: shiftwidth=2 sts=2 expandtab diff --git a/test/old/testdir/test_pyx3.vim b/test/old/testdir/test_pyx3.vim index 89a3cc22ff..8dfeaff807 100644 --- a/test/old/testdir/test_pyx3.vim +++ b/test/old/testdir/test_pyx3.vim @@ -97,7 +97,10 @@ result+='B' pyx << trim eof result+='E' eof - call assert_equal('ABCDE', pyxeval('result')) + pyx << trimm +result+='F' +trimm + call assert_equal('ABCDEF', pyxeval('result')) endfunc " vim: shiftwidth=2 sts=2 expandtab diff --git a/test/old/testdir/test_ruby.vim b/test/old/testdir/test_ruby.vim index 4d54d29df7..94941da873 100644 --- a/test/old/testdir/test_ruby.vim +++ b/test/old/testdir/test_ruby.vim @@ -439,7 +439,10 @@ Vim.command('let s ..= "B"') ruby << trim eof Vim.command('let s ..= "E"') eof - call assert_equal('ABCDE', s) +ruby << trimm +Vim.command('let s ..= "F"') +trimm + call assert_equal('ABCDEF', s) endfunc " vim: shiftwidth=2 sts=2 expandtab |