Mercurial > vim
comparison src/testdir/test_clientserver.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 | 546bdeef35f1 |
children | 031184ace7c5 |
comparison
equal
deleted
inserted
replaced
19851:e259e7903c55 | 19852:12518b40c161 |
---|---|
37 eval name->remote_foreground() | 37 eval name->remote_foreground() |
38 | 38 |
39 call remote_send(name, ":let testvar = 'yes'\<CR>") | 39 call remote_send(name, ":let testvar = 'yes'\<CR>") |
40 call WaitFor('remote_expr("' . name . '", "exists(\"testvar\") ? testvar : \"\"", "", 1) == "yes"') | 40 call WaitFor('remote_expr("' . name . '", "exists(\"testvar\") ? testvar : \"\"", "", 1) == "yes"') |
41 call assert_equal('yes', remote_expr(name, "testvar", "", 2)) | 41 call assert_equal('yes', remote_expr(name, "testvar", "", 2)) |
42 call assert_fails("let x=remote_expr(name, '2+x')", 'E449:') | |
43 call assert_fails("let x=remote_expr('[], '2+2')", 'E116:') | |
42 | 44 |
43 if has('unix') && has('gui') && !has('gui_running') | 45 if has('unix') && has('gui') && !has('gui_running') |
44 " Running in a terminal and the GUI is available: Tell the server to open | 46 " Running in a terminal and the GUI is available: Tell the server to open |
45 " the GUI and check that the remote command still works. | 47 " the GUI and check that the remote command still works. |
46 " Need to wait for the GUI to start up, otherwise the send hangs in trying | 48 " Need to wait for the GUI to start up, otherwise the send hangs in trying |
64 " Expression evaluated locally. | 66 " Expression evaluated locally. |
65 if v:servername == '' | 67 if v:servername == '' |
66 eval 'MYSELF'->remote_startserver() | 68 eval 'MYSELF'->remote_startserver() |
67 " May get MYSELF1 when running the test again. | 69 " May get MYSELF1 when running the test again. |
68 call assert_match('MYSELF', v:servername) | 70 call assert_match('MYSELF', v:servername) |
71 call assert_fails("call remote_startserver('MYSELF')", 'E941:') | |
69 endif | 72 endif |
70 let g:testvar = 'myself' | 73 let g:testvar = 'myself' |
71 call assert_equal('myself', remote_expr(v:servername, 'testvar')) | 74 call assert_equal('myself', remote_expr(v:servername, 'testvar')) |
72 | 75 |
73 call remote_send(name, ":call server2client(expand('<client>'), 'got it')\<CR>", 'g:myserverid') | 76 call remote_send(name, ":call server2client(expand('<client>'), 'got it')\<CR>", 'g:myserverid') |
98 call job_stop(job, 'kill') | 101 call job_stop(job, 'kill') |
99 endif | 102 endif |
100 endtry | 103 endtry |
101 | 104 |
102 call assert_fails("let x=remote_peek([])", 'E730:') | 105 call assert_fails("let x=remote_peek([])", 'E730:') |
106 call assert_fails("let x=remote_read('vim10')", 'E277:') | |
103 endfunc | 107 endfunc |
104 | 108 |
105 " Uncomment this line to get a debugging log | 109 " Uncomment this line to get a debugging log |
106 " call ch_logfile('channellog', 'w') | 110 " call ch_logfile('channellog', 'w') |
107 | 111 |