diff options
author | Bram Moolenaar <Bram@vim.org> | 2019-11-09 22:28:11 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2019-11-09 22:28:11 +0100 |
commit | b0745b221d284e381f1bd4b591cd68ea54b6a51d (patch) | |
tree | 7dcb9c03cfc28c3c84359d9f04ec2d41d1173f2c /src/testdir/test_substitute.vim | |
parent | dbd4316806389e3c2240b48cc6c4d209cb1665fd (diff) |
patch 8.1.2280: crash when passing partial to substitute()v8.1.2280
Problem: Crash when passing partial to substitute().
Solution: Take extra arguments into account. (closes #5186)
Diffstat (limited to 'src/testdir/test_substitute.vim')
-rw-r--r-- | src/testdir/test_substitute.vim | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/testdir/test_substitute.vim b/src/testdir/test_substitute.vim index e8b0e49c2e..b30464ff1a 100644 --- a/src/testdir/test_substitute.vim +++ b/src/testdir/test_substitute.vim @@ -405,6 +405,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 + " Tests for *sub-replace-special* and *sub-replace-expression* on :substitute. " Execute a list of :substitute command tests |