comparison src/testdir/test_vim9_assign.vim @ 25519:f7db86111acd v8.2.3296

patch 8.2.3296: Vim9: cannot add a number to a float Commit: https://github.com/vim/vim/commit/af647e76cacc60d3cfc5df3ff5b3d9d4b69b519d Author: Bram Moolenaar <Bram@vim.org> Date: Thu Aug 5 19:01:17 2021 +0200 patch 8.2.3296: Vim9: cannot add a number to a float Problem: Vim9: cannot add a number to a float. Solution: Accept a number if the destination is a float. (closes https://github.com/vim/vim/issues/8703)
author Bram Moolenaar <Bram@vim.org>
date Thu, 05 Aug 2021 19:15:04 +0200
parents 911fdca7f736
children ec4df0b982da
comparison
equal deleted inserted replaced
25518:f0de0b105458 25519:f7db86111acd
241 CheckDefFailure(['v:errmsg += 123'], 'E1012:') 241 CheckDefFailure(['v:errmsg += 123'], 'E1012:')
242 242
243 var text =<< trim END 243 var text =<< trim END
244 some text 244 some text
245 END 245 END
246 enddef
247
248 def Test_float_and_number()
249 if !has('float')
250 MissingFeature float
251 else
252 var lines =<< trim END
253 var f: float
254 f += 2
255 f -= 1
256 assert_equal(1.0, f)
257 ++f
258 --f
259 assert_equal(1.0, f)
260 END
261 CheckDefAndScriptSuccess(lines)
262 endif
246 enddef 263 enddef
247 264
248 let g:someNumber = 43 265 let g:someNumber = 43
249 266
250 def Test_assign_concat() 267 def Test_assign_concat()