mirror of
https://github.com/neovim/neovim.git
synced 2025-12-16 03:15:39 +00:00
vim-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.
3cfa5b16b0
Co-authored-by: Bram Moolenaar <Bram@vim.org>
This commit is contained in:
@@ -153,11 +153,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
|
||||
|
||||
@@ -221,7 +223,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
|
||||
@@ -372,7 +376,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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user