diff src/testdir/test_terminal.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 165ec447ca77
children 820f24dc1e3e
line wrap: on
line diff
--- a/src/testdir/test_terminal.vim
+++ b/src/testdir/test_terminal.vim
@@ -2634,4 +2634,22 @@ func Test_term_and_startinsert()
   call delete('XTest_startinsert')
 endfunc
 
+" Test for passing invalid arguments to terminal functions
+func Test_term_func_invalid_arg()
+  call assert_fails('let b = term_getaltscreen([])', 'E745:')
+  call assert_fails('let p = term_getansicolors([])', 'E745:')
+  call assert_fails('let a = term_getattr(1, [])', 'E730:')
+  call assert_fails('let c = term_getcursor([])', 'E745:')
+  call assert_fails('let l = term_getline([], 1)', 'E745:')
+  call assert_fails('let l = term_getscrolled([])', 'E745:')
+  call assert_fails('let s = term_getsize([])', 'E745:')
+  call assert_fails('let s = term_getstatus([])', 'E745:')
+  call assert_fails('let s = term_scrape([], 1)', 'E745:')
+  call assert_fails('call term_sendkeys([], "a")', 'E745:')
+  call assert_fails('call term_setansicolors([], [])', 'E745:')
+  call assert_fails('call term_setapi([], "")', 'E745:')
+  call assert_fails('call term_setrestore([], "")', 'E745:')
+  call assert_fails('call term_setkill([], "")', 'E745:')
+endfunc
+
 " vim: shiftwidth=2 sts=2 expandtab