Mercurial > vim
changeset 19469:55656a51d2af v8.2.0292
patch 8.2.0292: Vim9: CHECKNR and CHECKTYPE instructions not tested
Commit: https://github.com/vim/vim/commit/09f28f49c9b5973593f8a9b445cdc2ed3da630b6
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Feb 20 23:08:34 2020 +0100
patch 8.2.0292: Vim9: CHECKNR and CHECKTYPE instructions not tested
Problem: Vim9: CHECKNR and CHECKTYPE instructions not tested.
Solution: Add tests.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 20 Feb 2020 23:15:03 +0100 |
parents | 60814cbadf88 |
children | ddc2e7caff46 |
files | src/testdir/test_vim9_expr.vim src/testdir/test_vim9_script.vim src/version.c |
diffstat | 3 files changed, 14 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/testdir/test_vim9_expr.vim +++ b/src/testdir/test_vim9_expr.vim @@ -781,6 +781,11 @@ func Test_expr7_fails() call CheckDefExecFailure("echo s:doesnt_exist", 'E121:') call CheckDefExecFailure("echo g:doesnt_exist", 'E121:') + + call CheckDefExecFailure("let x = +g:astring", 'E1030:') + call CheckDefExecFailure("let x = +g:ablob", 'E974:') + call CheckDefExecFailure("let x = +g:alist", 'E745:') + call CheckDefExecFailure("let x = +g:adict", 'E728:') endfunc let g:Funcrefs = [function('add')]
--- a/src/testdir/test_vim9_script.vim +++ b/src/testdir/test_vim9_script.vim @@ -114,9 +114,16 @@ def ReturnNumber(): number return 123 enddef +let g:notNumber = 'string' + +def ReturnGlobal(): number + return g:notNumber +enddef + def Test_return_string() assert_equal('string', ReturnString()) assert_equal(123, ReturnNumber()) + assert_fails('call ReturnGlobal()', 'E1029: Expected number but got string') enddef func Increment()