diff options
| author | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2020-03-18 00:47:46 -0400 |
|---|---|---|
| committer | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2020-04-13 12:00:31 -0400 |
| commit | dbb386e1b277004e37902fd1c794727277312765 (patch) | |
| tree | 856b1b4ab481bcaf624cf3e73393d9f97d0b869f /src/nvim/testdir | |
| parent | 60a7184185a5656f723f17ab3d09157813baae13 (diff) | |
| download | rneovim-dbb386e1b277004e37902fd1c794727277312765.tar.gz rneovim-dbb386e1b277004e37902fd1c794727277312765.tar.bz2 rneovim-dbb386e1b277004e37902fd1c794727277312765.zip | |
vim-patch:8.1.2280: crash when passing partial to substitute()
Problem: Crash when passing partial to substitute().
Solution: Take extra arguments into account. (closes vim/vim#5186)
https://github.com/vim/vim/commit/b0745b221d284e381f1bd4b591cd68ea54b6a51d
Diffstat (limited to 'src/nvim/testdir')
| -rw-r--r-- | src/nvim/testdir/test_substitute.vim | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/nvim/testdir/test_substitute.vim b/src/nvim/testdir/test_substitute.vim index e94bd22cea..25a8676b0c 100644 --- a/src/nvim/testdir/test_substitute.vim +++ b/src/nvim/testdir/test_substitute.vim @@ -613,6 +613,14 @@ func Test_sub_replace_10() call assert_equal('1aaa', substitute('123', '1\zs\|[23]', 'a', 'g')) endfunc +func SubReplacer(text, submatches) + return a:text .. a:submatches[0] .. a:text +endfunc + +func Test_substitute_partial() + call assert_equal('1foo2foo3', substitute('123', '2', function('SubReplacer', ['foo']), 'g')) +endfunc + func Test_sub_cmd_9() new let input = ['1 aaa', '2 aaa', '3 aaa'] |