Mercurial > vim
diff src/testdir/test_vimscript.vim @ 19724:b3e93a05c3ca v8.2.0418
patch 8.2.0418: code in eval.c not sufficiently covered by tests
Commit: https://github.com/vim/vim/commit/8b633135106dda8605463b780573c45b00c22afe
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri Mar 20 18:20:51 2020 +0100
patch 8.2.0418: code in eval.c not sufficiently covered by tests
Problem: Code in eval.c not sufficiently covered by tests.
Solution: Add more tests. (Yegappan Lakshmanan, closes https://github.com/vim/vim/issues/5815)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Fri, 20 Mar 2020 18:30:05 +0100 |
parents | da98d2ed8dc5 |
children | 2c4d9ca33769 |
line wrap: on
line diff
--- a/src/testdir/test_vimscript.vim +++ b/src/testdir/test_vimscript.vim @@ -1737,6 +1737,8 @@ func Test_compound_assignment_operators( call assert_equal(4.2, x) call assert_fails('let x %= 0.5', 'E734') call assert_fails('let x .= "f"', 'E734') + let x = !3.14 + call assert_equal(0.0, x) endif " Test for environment variable @@ -2083,6 +2085,20 @@ func Test_sfile_in_function() delfunc Xfunc endfunc +" Test for errors in converting to float from various types {{{1 +func Test_float_conversion_errors() + if has('float') + call assert_fails('let x = 4.0 % 2.0', 'E804') + call assert_fails('echo 1.1[0]', 'E806') + call assert_fails('echo sort([function("min"), 1], "f")', 'E891:') + call assert_fails('echo 3.2 == "vim"', 'E892:') + call assert_fails('echo sort([[], 1], "f")', 'E893:') + call assert_fails('echo sort([{}, 1], "f")', 'E894:') + call assert_fails('echo 3.2 == v:true', 'E362:') + call assert_fails('echo 3.2 == v:none', 'E907:') + endif +endfunc + "------------------------------------------------------------------------------- " Modelines {{{1 " vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker