summaryrefslogtreecommitdiff
path: root/src/testdir/test_vim9_builtin.vim
diff options
context:
space:
mode:
authorLemonBoy <thatlemon@gmail.com>2022-05-05 13:53:03 +0100
committerBram Moolenaar <Bram@vim.org>2022-05-05 13:53:03 +0100
commitf3b4895f2727e3849ca10030b251cccd9d1383f3 (patch)
tree97af9696abeba219135a0baf1947058cd4d5d995 /src/testdir/test_vim9_builtin.vim
parente442d59f6d6732c226d636067c07b7342838b36b (diff)
downloadvim-git-f3b4895f2727e3849ca10030b251cccd9d1383f3.tar.gz
patch 8.2.4870: Vim9: expression in :substitute is not compiledv8.2.4870
Problem: Vim9: expression in :substitute is not compiled. Solution: Use an INSTR instruction if possible. (closes #10334)
Diffstat (limited to 'src/testdir/test_vim9_builtin.vim')
-rw-r--r--src/testdir/test_vim9_builtin.vim5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/testdir/test_vim9_builtin.vim b/src/testdir/test_vim9_builtin.vim
index 7b64fc444..41093f001 100644
--- a/src/testdir/test_vim9_builtin.vim
+++ b/src/testdir/test_vim9_builtin.vim
@@ -4078,6 +4078,11 @@ def Test_substitute()
v9.CheckDefAndScriptFailure(['substitute("a", 2, "1", "d")'], ['E1013: Argument 2: type mismatch, expected string but got number', 'E1174: String required for argument 2'])
v9.CheckDefAndScriptFailure(['substitute("a", "b", "1", 4)'], ['E1013: Argument 4: type mismatch, expected string but got number', 'E1174: String required for argument 4'])
substitute('', '', '', '')->assert_equal('')
+
+ var lines =<< trim END
+ assert_equal("4", substitute("3", '\d', '\=str2nr(submatch(0)) + 1', 'g'))
+ END
+ v9.CheckDefAndScriptSuccess(lines)
enddef
def Test_swapinfo()