diff options
| author | zeertzjq <zeertzjq@outlook.com> | 2022-03-09 06:54:35 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-03-09 06:54:35 +0800 |
| commit | f33cea4682340ea2b622fa879dd6fca2c80ea1d5 (patch) | |
| tree | 0617dee3a568cb5e03de828b494c5571fabe9442 /src/nvim/testdir | |
| parent | f24121ad96d7f560a36f0d977766d4e8232fbda6 (diff) | |
| parent | 165cf1b48e4505b2b8aa9ff0522c9176a073b7ea (diff) | |
| download | rneovim-f33cea4682340ea2b622fa879dd6fca2c80ea1d5.tar.gz rneovim-f33cea4682340ea2b622fa879dd6fca2c80ea1d5.tar.bz2 rneovim-f33cea4682340ea2b622fa879dd6fca2c80ea1d5.zip | |
Merge pull request #17505 from zeertzjq/vim-8.2.0997
vim-patch:8.2.0997: cannot execute a register containing line continuation
Diffstat (limited to 'src/nvim/testdir')
| -rw-r--r-- | src/nvim/testdir/test_registers.vim | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/src/nvim/testdir/test_registers.vim b/src/nvim/testdir/test_registers.vim index 23e39eba35..ecc65b240b 100644 --- a/src/nvim/testdir/test_registers.vim +++ b/src/nvim/testdir/test_registers.vim @@ -482,6 +482,82 @@ func Test_v_register() bwipe! endfunc +" Test for executing the contents of a register as an Ex command with line +" continuation. +func Test_execute_reg_as_ex_cmd() + " Line continuation with just two lines + let code =<< trim END + let l = [ + \ 1] + END + let @r = code->join("\n") + let l = [] + @r + call assert_equal([1], l) + + " Line continuation with more than two lines + let code =<< trim END + let l = [ + \ 1, + \ 2, + \ 3] + END + let @r = code->join("\n") + let l = [] + @r + call assert_equal([1, 2, 3], l) + + " use comments interspersed with code + let code =<< trim END + let l = [ + "\ one + \ 1, + "\ two + \ 2, + "\ three + \ 3] + END + let @r = code->join("\n") + let l = [] + @r + call assert_equal([1, 2, 3], l) + + " use line continuation in the middle + let code =<< trim END + let a = "one" + let l = [ + \ 1, + \ 2] + let b = "two" + END + let @r = code->join("\n") + let l = [] + @r + call assert_equal([1, 2], l) + call assert_equal("one", a) + call assert_equal("two", b) + + " only one line with a \ + let @r = "\\let l = 1" + call assert_fails('@r', 'E10:') + + " only one line with a "\ + let @r = ' "\ let i = 1' + @r + call assert_false(exists('i')) + + " first line also begins with a \ + let @r = "\\let l = [\n\\ 1]" + call assert_fails('@r', 'E10:') + + " Test with a large number of lines + let @r = "let str = \n" + let @r ..= repeat(" \\ 'abcdefghijklmnopqrstuvwxyz' ..\n", 312) + let @r ..= ' \ ""' + @r + call assert_equal(repeat('abcdefghijklmnopqrstuvwxyz', 312), str) +endfunc + func Test_ve_blockpaste() new set ve=all |