Mercurial > vim
comparison src/testdir/test_terminal.vim @ 19852:12518b40c161 v8.2.0482
patch 8.2.0482: channel and sandbox code not sufficiently tested
Commit: https://github.com/vim/vim/commit/ca68ae13114619df3e4c195b41ad0575516f5ff6
Author: Bram Moolenaar <Bram@vim.org>
Date: Mon Mar 30 19:32:53 2020 +0200
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 https://github.com/vim/vim/issues/5855)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Mon, 30 Mar 2020 19:45:05 +0200 |
parents | 9981509b665f |
children | 648752e0d579 |
comparison
equal
deleted
inserted
replaced
19851:e259e7903c55 | 19852:12518b40c161 |
---|---|
999 call assert_fails(cmd, 'E474') | 999 call assert_fails(cmd, 'E474') |
1000 let cmd = "call term_start({}, {'curwin' : 1, 'term_finish' : 'close'})" | 1000 let cmd = "call term_start({}, {'curwin' : 1, 'term_finish' : 'close'})" |
1001 call assert_fails(cmd, 'E474') | 1001 call assert_fails(cmd, 'E474') |
1002 let cmd = "call term_start(0, {'curwin' : 1, 'term_finish' : 'close'})" | 1002 let cmd = "call term_start(0, {'curwin' : 1, 'term_finish' : 'close'})" |
1003 call assert_fails(cmd, 'E474') | 1003 call assert_fails(cmd, 'E474') |
1004 let cmd = "call term_start('', {'term_name' : []})" | |
1005 call assert_fails(cmd, 'E475') | |
1006 let cmd = "call term_start('', {'term_finish' : 'axby'})" | |
1007 call assert_fails(cmd, 'E475') | |
1008 let cmd = "call term_start('', {'eof_chars' : []})" | |
1009 call assert_fails(cmd, 'E475:') | |
1010 let cmd = "call term_start('', {'term_kill' : []})" | |
1011 call assert_fails(cmd, 'E475:') | |
1012 let cmd = "call term_start('', {'tty_type' : []})" | |
1013 call assert_fails(cmd, 'E475:') | |
1014 let cmd = "call term_start('', {'tty_type' : 'abc'})" | |
1015 call assert_fails(cmd, 'E475:') | |
1016 let cmd = "call term_start('', {'term_highlight' : []})" | |
1017 call assert_fails(cmd, 'E475:') | |
1018 if has('gui') | |
1019 let cmd = "call term_start('', {'ansi_colors' : 'abc'})" | |
1020 call assert_fails(cmd, 'E475:') | |
1021 let cmd = "call term_start('', {'ansi_colors' : [[]]})" | |
1022 call assert_fails(cmd, 'E730:') | |
1023 let cmd = "call term_start('', {'ansi_colors' : repeat(['blue'], 18)})" | |
1024 call assert_fails(cmd, 'E475:') | |
1025 endif | |
1004 endfunc | 1026 endfunc |
1005 | 1027 |
1006 func Test_terminal_response_to_control_sequence() | 1028 func Test_terminal_response_to_control_sequence() |
1007 CheckUnix | 1029 CheckUnix |
1008 | 1030 |
1283 quit | 1305 quit |
1284 | 1306 |
1285 call assert_equal(1, winnr('$')) | 1307 call assert_equal(1, winnr('$')) |
1286 call term_dumpdiff('dumps/Test_popup_command_01.dump', 'dumps/Test_popup_command_02.dump', {'curwin': 1}) | 1308 call term_dumpdiff('dumps/Test_popup_command_01.dump', 'dumps/Test_popup_command_02.dump', {'curwin': 1}) |
1287 call assert_equal(1, winnr('$')) | 1309 call assert_equal(1, winnr('$')) |
1310 call assert_fails("call term_dumpdiff('dumps/Test_popup_command_01.dump', 'dumps/Test_popup_command_02.dump', {'bufnr': -1})", 'E475:') | |
1288 bwipe | 1311 bwipe |
1289 | 1312 |
1290 set laststatus& | 1313 set laststatus& |
1291 endfunc | 1314 endfunc |
1292 | 1315 |
1483 let buf = RunVimInTerminal('-S Xscript', {'term_api': 'ApiCall_'}) | 1506 let buf = RunVimInTerminal('-S Xscript', {'term_api': 'ApiCall_'}) |
1484 call WaitFor({-> exists('g:called_bufnum2')}) | 1507 call WaitFor({-> exists('g:called_bufnum2')}) |
1485 call assert_equal(buf, g:called_bufnum2) | 1508 call assert_equal(buf, g:called_bufnum2) |
1486 call assert_equal(['hello', 123], g:called_arg2) | 1509 call assert_equal(['hello', 123], g:called_arg2) |
1487 call StopVimInTerminal(buf) | 1510 call StopVimInTerminal(buf) |
1511 | |
1512 call assert_fails("call term_start('ls', {'term_api' : []})", 'E475:') | |
1488 | 1513 |
1489 unlet! g:called_bufnum2 | 1514 unlet! g:called_bufnum2 |
1490 unlet! g:called_arg2 | 1515 unlet! g:called_arg2 |
1491 | 1516 |
1492 call delete('Xscript') | 1517 call delete('Xscript') |
2550 call term_sendkeys(g:buf0, "exit\<CR>") | 2575 call term_sendkeys(g:buf0, "exit\<CR>") |
2551 call term_wait(g:buf0, 100) | 2576 call term_wait(g:buf0, 100) |
2552 exe g:buf0 .. 'bwipe!' | 2577 exe g:buf0 .. 'bwipe!' |
2553 set hidden& | 2578 set hidden& |
2554 endfunc | 2579 endfunc |
2580 | |
2581 " vim: shiftwidth=2 sts=2 expandtab |