diff src/testdir/test_substitute.vim @ 24820:b1093c1ac109 v8.2.2948

patch 8.2.2948: substitute() accepts a number but not a float expression Commit: https://github.com/vim/vim/commit/7a2217bedd223df4c8bbebe731bf0b5fe8532533 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Jun 6 12:33:49 2021 +0200 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 https://github.com/vim/vim/issues/8331)
author Bram Moolenaar <Bram@vim.org>
date Sun, 06 Jun 2021 12:45:02 +0200
parents 87ff80c08e4b
children 28f1b7c38ba1
line wrap: on
line diff
--- 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 @@ func Test_substitute_partial()
    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