patch 8.2.2948: substitute() accepts a number but not a float expression
Problem: Substitute() accepts a number but not a float expression.
Solution: Also accept a float. (closes #8331)
diff --git a/src/testdir/test_substitute.vim b/src/testdir/test_substitute.vim
index 4c99f81..0c36748 100644
--- a/src/testdir/test_substitute.vim
+++ b/src/testdir/test_substitute.vim
@@ -1,6 +1,7 @@
" Tests for multi-line regexps with ":s".
source shared.vim
+source check.vim
func Test_multiline_subst()
enew!
@@ -453,6 +454,13 @@
call assert_fails("call substitute('123', '2', Replacer, 'g')", 'E118:')
endfunc
+func Test_substitute_float()
+ CheckFeature float
+
+ call assert_equal('number 1.23', substitute('number ', '$', { -> 1.23 }, ''))
+ vim9 assert_equal('number 1.23', substitute('number ', '$', () => 1.23, ''))
+endfunc
+
" Tests for *sub-replace-special* and *sub-replace-expression* on :substitute.
" Execute a list of :substitute command tests