patch 8.2.0482: channel and sandbox code not sufficiently tested
Problem: Channel and sandbox code not sufficiently tested.
Solution: Add more tests. (Yegappan Lakshmanan, closes #5855)
diff --git a/src/testdir/test_terminal.vim b/src/testdir/test_terminal.vim
index 40749c4..9e20a77 100644
--- a/src/testdir/test_terminal.vim
+++ b/src/testdir/test_terminal.vim
@@ -1001,6 +1001,28 @@
call assert_fails(cmd, 'E474')
let cmd = "call term_start(0, {'curwin' : 1, 'term_finish' : 'close'})"
call assert_fails(cmd, 'E474')
+ let cmd = "call term_start('', {'term_name' : []})"
+ call assert_fails(cmd, 'E475')
+ let cmd = "call term_start('', {'term_finish' : 'axby'})"
+ call assert_fails(cmd, 'E475')
+ let cmd = "call term_start('', {'eof_chars' : []})"
+ call assert_fails(cmd, 'E475:')
+ let cmd = "call term_start('', {'term_kill' : []})"
+ call assert_fails(cmd, 'E475:')
+ let cmd = "call term_start('', {'tty_type' : []})"
+ call assert_fails(cmd, 'E475:')
+ let cmd = "call term_start('', {'tty_type' : 'abc'})"
+ call assert_fails(cmd, 'E475:')
+ let cmd = "call term_start('', {'term_highlight' : []})"
+ call assert_fails(cmd, 'E475:')
+ if has('gui')
+ let cmd = "call term_start('', {'ansi_colors' : 'abc'})"
+ call assert_fails(cmd, 'E475:')
+ let cmd = "call term_start('', {'ansi_colors' : [[]]})"
+ call assert_fails(cmd, 'E730:')
+ let cmd = "call term_start('', {'ansi_colors' : repeat(['blue'], 18)})"
+ call assert_fails(cmd, 'E475:')
+ endif
endfunc
func Test_terminal_response_to_control_sequence()
@@ -1285,6 +1307,7 @@
call assert_equal(1, winnr('$'))
call term_dumpdiff('dumps/Test_popup_command_01.dump', 'dumps/Test_popup_command_02.dump', {'curwin': 1})
call assert_equal(1, winnr('$'))
+ call assert_fails("call term_dumpdiff('dumps/Test_popup_command_01.dump', 'dumps/Test_popup_command_02.dump', {'bufnr': -1})", 'E475:')
bwipe
set laststatus&
@@ -1486,6 +1509,8 @@
call assert_equal(['hello', 123], g:called_arg2)
call StopVimInTerminal(buf)
+ call assert_fails("call term_start('ls', {'term_api' : []})", 'E475:')
+
unlet! g:called_bufnum2
unlet! g:called_arg2
@@ -2552,3 +2577,5 @@
exe g:buf0 .. 'bwipe!'
set hidden&
endfunc
+
+" vim: shiftwidth=2 sts=2 expandtab