Mercurial > vim
diff src/testdir/test_functions.vim @ 20178:2fb397573541
patch 8.2.0644: insufficient testing for invalid function arguments
Commit: https://github.com/vim/vim/commit/99fa721944dda9d07c53c907c33466728df5c271
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Apr 26 15:59:55 2020 +0200
patch 8.2.0644: insufficient testing for invalid function arguments
Problem: Insufficient testing for invalid function arguments.
Solution: Add more tests. (Yegappan Lakshmanan, closes https://github.com/vim/vim/issues/5988)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 26 Apr 2020 16:00:04 +0200 |
parents | 94f05de75e9f |
children | 244eb8d8d100 |
line wrap: on
line diff
--- a/src/testdir/test_functions.vim +++ b/src/testdir/test_functions.vim @@ -29,6 +29,8 @@ func Test_has() call assert_equal(0, and(has('ttyout'), 0)) call assert_equal(1, has('multi_byte_encoding')) endif + call assert_equal(1, has('vcon', 1)) + call assert_equal(1, has('mouse_gpm_enabled', 1)) call assert_equal(0, has('nonexistent')) call assert_equal(0, has('nonexistent', 1)) @@ -1304,12 +1306,15 @@ endfunc " Test for the inputdialog() function func Test_inputdialog() - CheckNotGui - - call feedkeys(":let v=inputdialog('Q:', 'xx', 'yy')\<CR>\<CR>", 'xt') - call assert_equal('xx', v) - call feedkeys(":let v=inputdialog('Q:', 'xx', 'yy')\<CR>\<Esc>", 'xt') - call assert_equal('yy', v) + if has('gui_running') + call assert_fails('let v=inputdialog([], "xx")', 'E730:') + call assert_fails('let v=inputdialog("Q", [])', 'E730:') + else + call feedkeys(":let v=inputdialog('Q:', 'xx', 'yy')\<CR>\<CR>", 'xt') + call assert_equal('xx', v) + call feedkeys(":let v=inputdialog('Q:', 'xx', 'yy')\<CR>\<Esc>", 'xt') + call assert_equal('yy', v) + endif endfunc " Test for inputlist() @@ -1344,6 +1349,7 @@ func Test_balloon_show() call balloon_show('hi!') if !has('gui_running') call balloon_show(range(3)) + call balloon_show([]) endif endif endfunc @@ -2213,6 +2219,9 @@ func Test_range() call assert_fails('let x=range(2, 8, 0)', 'E726:') call assert_fails('let x=range(3, 1)', 'E727:') call assert_fails('let x=range(1, 3, -2)', 'E727:') + call assert_fails('let x=range([])', 'E745:') + call assert_fails('let x=range(1, [])', 'E745:') + call assert_fails('let x=range(1, 4, [])', 'E745:') endfunc func Test_echoraw()