Mercurial > vim
diff src/testdir/test_functions.vim @ 24822:5f8dd7b3ae41 v8.2.2949
patch 8.2.2949: tests failing because no error for float to string conversion
Commit: https://github.com/vim/vim/commit/3cfa5b16b06bcc034f6de77070fa779d698ab5e9
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Jun 6 14:14:39 2021 +0200
patch 8.2.2949: tests failing because no error for float to string conversion
Problem: Tests failing because there is no error for float to string
conversion.
Solution: Change the check for failure to check for correct result. Make
some conversions strict in Vim9 script.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 06 Jun 2021 14:15:04 +0200 |
parents | 29ed95687f74 |
children | 3f9053c21765 |
line wrap: on
line diff
--- a/src/testdir/test_functions.vim +++ b/src/testdir/test_functions.vim @@ -165,11 +165,13 @@ func Test_strwidth() call assert_fails('call strwidth({->0})', 'E729:') call assert_fails('call strwidth([])', 'E730:') call assert_fails('call strwidth({})', 'E731:') - if has('float') - call assert_fails('call strwidth(1.2)', 'E806:') - endif endfor + if has('float') + call assert_equal(3, strwidth(1.2)) + call CheckDefExecAndScriptFailure(['echo strwidth(1.2)'], 'E806:') + endif + set ambiwidth& endfunc @@ -233,7 +235,9 @@ func Test_str2nr() call assert_fails('call str2nr([])', 'E730:') call assert_fails('call str2nr({->2})', 'E729:') if has('float') - call assert_fails('call str2nr(1.2)', 'E806:') + call assert_equal(1, str2nr(1.2)) + call CheckDefExecFailure(['echo str2nr(1.2)'], 'E1013:') + call CheckScriptFailure(['vim9script', 'echo str2nr(1.2)'], 'E806:') endif call assert_fails('call str2nr(10, [])', 'E745:') endfunc @@ -494,7 +498,8 @@ func Test_simplify() call assert_fails('call simplify([])', 'E730:') call assert_fails('call simplify({})', 'E731:') if has('float') - call assert_fails('call simplify(1.2)', 'E806:') + call assert_equal('1.2', simplify(1.2)) + call CheckDefExecAndScriptFailure(['echo simplify(1.2)'], 'E806:') endif endfunc