diff options
author | Bram Moolenaar <Bram@vim.org> | 2021-07-14 21:00:41 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2021-07-14 21:00:41 +0200 |
commit | c816a2c22667108fcd61f445de2c926f78ff9fa7 (patch) | |
tree | f6b7fe9ee819ac64e1c2602a52c5c66ae1a0390d /src/testdir | |
parent | 4a0b85ad0193ac162e2d8458e4b1c5ad2e2b0193 (diff) |
patch 8.2.3161: Vim9: no error when reltime() has invalid argumentsv8.2.3161
Problem: Vim9: no error when reltime() has invalid arguments.
Solution: Add an error. (closes #8562)
Diffstat (limited to 'src/testdir')
-rw-r--r-- | src/testdir/test_vim9_builtin.vim | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/testdir/test_vim9_builtin.vim b/src/testdir/test_vim9_builtin.vim index 03bc3fbe30..f5315f91f1 100644 --- a/src/testdir/test_vim9_builtin.vim +++ b/src/testdir/test_vim9_builtin.vim @@ -1652,6 +1652,11 @@ def Test_readfile() enddef def Test_reltime() + CheckFeature reltime + + CheckDefExecAndScriptFailure(['[]->reltime()'], 'E474:') + CheckDefExecAndScriptFailure(['[]->reltime([])'], 'E474:') + CheckDefFailure(['reltime("x")'], 'E1013: Argument 1: type mismatch, expected list<number> but got string') CheckDefFailure(['reltime(["x", "y"])'], 'E1013: Argument 1: type mismatch, expected list<number> but got list<string>') CheckDefFailure(['reltime([1, 2], 10)'], 'E1013: Argument 2: type mismatch, expected list<number> but got number') @@ -1663,12 +1668,20 @@ def Test_reltime() enddef def Test_reltimefloat() + CheckFeature reltime + + CheckDefExecAndScriptFailure(['[]->reltimefloat()'], 'E474:') + CheckDefFailure(['reltimefloat("x")'], 'E1013: Argument 1: type mismatch, expected list<number> but got string') CheckDefFailure(['reltimefloat([1.1])'], 'E1013: Argument 1: type mismatch, expected list<number> but got list<float>') assert_true(type(reltimefloat(reltime())) == v:t_float) enddef def Test_reltimestr() + CheckFeature reltime + + CheckDefExecAndScriptFailure(['[]->reltimestr()'], 'E474:') + CheckDefFailure(['reltimestr(true)'], 'E1013: Argument 1: type mismatch, expected list<number> but got bool') CheckDefFailure(['reltimestr([true])'], 'E1013: Argument 1: type mismatch, expected list<number> but got list<bool>') assert_true(type(reltimestr(reltime())) == v:t_string) |