1
0
forked from aniani/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.
This commit is contained in:
Bram Moolenaar
2021-06-06 14:14:39 +02:00
parent 7a2217bedd
commit 3cfa5b16b0
12 changed files with 46 additions and 19 deletions

View File

@@ -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