summaryrefslogtreecommitdiff
path: root/src/testdir/test_functions.vim
diff options
context:
space:
mode:
authorYegappan Lakshmanan <yegappan@yahoo.com>2021-07-27 22:00:44 +0200
committerBram Moolenaar <Bram@vim.org>2021-07-27 22:00:44 +0200
commit4490ec4e839e45a2e6923c265c7e9e64c240b805 (patch)
tree3ef2dc127890ac6a644f38ae7932b7e70071544a /src/testdir/test_functions.vim
parent5d7c2df536c17db4a9c61e0760bdcf78d0db7330 (diff)
downloadvim-git-4490ec4e839e45a2e6923c265c7e9e64c240b805.tar.gz
patch 8.2.3229: Vim9: runtime and compile time type checks are not the samev8.2.3229
Problem: Vim9: runtime and compile time type checks are not the same. Solution: Add more runtime type checks for builtin functions. (Yegappan Lakshmanan, closes #8646)
Diffstat (limited to 'src/testdir/test_functions.vim')
-rw-r--r--src/testdir/test_functions.vim9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/testdir/test_functions.vim b/src/testdir/test_functions.vim
index e0b0314d3..6f2797c49 100644
--- a/src/testdir/test_functions.vim
+++ b/src/testdir/test_functions.vim
@@ -174,8 +174,7 @@ func Test_strwidth()
if has('float')
call assert_equal(3, strwidth(1.2))
- call CheckDefFailure(['echo strwidth(1.2)'], 'E1013:')
- call CheckScriptFailure(['vim9script', 'echo strwidth(1.2)'], 'E806:')
+ call CheckDefAndScriptFailure2(['echo strwidth(1.2)'], 'E1013: Argument 1: type mismatch, expected string but got float', 'E1174: String required for argument 1')
endif
set ambiwidth&
@@ -242,8 +241,7 @@ func Test_str2nr()
call assert_fails('call str2nr({->2})', 'E729:')
if has('float')
call assert_equal(1, str2nr(1.2))
- call CheckDefFailure(['echo str2nr(1.2)'], 'E1013:')
- call CheckScriptFailure(['vim9script', 'echo str2nr(1.2)'], 'E806:')
+ call CheckDefAndScriptFailure2(['echo str2nr(1.2)'], 'E1013: Argument 1: type mismatch, expected string but got float', 'E1174: String required for argument 1')
endif
call assert_fails('call str2nr(10, [])', 'E745:')
endfunc
@@ -505,8 +503,7 @@ func Test_simplify()
call assert_fails('call simplify({})', 'E731:')
if has('float')
call assert_equal('1.2', simplify(1.2))
- call CheckDefFailure(['echo simplify(1.2)'], 'E1013:')
- call CheckScriptFailure(['vim9script', 'echo simplify(1.2)'], 'E806:')
+ call CheckDefAndScriptFailure2(['echo simplify(1.2)'], 'E1013: Argument 1: type mismatch, expected string but got float', 'E1174: String required for argument 1')
endif
endfunc