summaryrefslogtreecommitdiffstats
path: root/src/testdir/test_clientserver.vim
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2017-03-18 18:10:13 +0100
committerBram Moolenaar <Bram@vim.org>2017-03-18 18:10:13 +0100
commit7416f3e73ab2c4e7ae3adc2ff6e70234f7d40d2e (patch)
tree7bc5f55c1b3a71dee7a0fe23ca77f51262bff08e /src/testdir/test_clientserver.vim
parent15bf76d40be1f1622ff5cc16596c308e76e2ca94 (diff)
patch 8.0.0475: not enough testing for the client-server featurev8.0.0475
Problem: Not enough testing for the client-server feature. Solution: Add more tests. Add the remote_startserver() function. Fix that a locally evaluated expression uses function-local variables.
Diffstat (limited to 'src/testdir/test_clientserver.vim')
-rw-r--r--src/testdir/test_clientserver.vim25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/testdir/test_clientserver.vim b/src/testdir/test_clientserver.vim
index 55cc98ec8d..55f440ffc2 100644
--- a/src/testdir/test_clientserver.vim
+++ b/src/testdir/test_clientserver.vim
@@ -30,6 +30,31 @@ func Test_client_server()
call WaitFor('remote_expr("' . name . '", "testvar") == "yes"')
call assert_equal('yes', remote_expr(name, "testvar"))
+ if has('unix') && has('gui') && !has('gui_running')
+ " Running in a terminal and the GUI is avaiable: Tell the server to open
+ " the GUI and check that the remote command still works.
+ " Need to wait for the GUI to start up, otherwise the send hangs in trying
+ " to send to the terminal window.
+ call remote_send(name, ":gui -f\<CR>")
+ sleep 500m
+ call remote_send(name, ":let testvar = 'maybe'\<CR>")
+ call WaitFor('remote_expr("' . name . '", "testvar") == "maybe"')
+ call assert_equal('maybe', remote_expr(name, "testvar"))
+ endif
+
+ call assert_fails('call remote_send("XXX", ":let testvar = ''yes''\<CR>")', 'E241')
+
+ " Expression evaluated locally.
+ if v:servername == ''
+ call remote_startserver('MYSELF')
+ call assert_equal('MYSELF', v:servername)
+ endif
+ let g:testvar = 'myself'
+ call assert_equal('myself', remote_expr(v:servername, 'testvar'))
+
+ call remote_send(name, ":call server2client(expand('<client>'), 'got it')\<CR>", 'g:myserverid')
+ call assert_equal('got it', remote_read(g:myserverid))
+
call remote_send(name, ":qa!\<CR>")
call WaitFor('job_status(g:job) == "dead"')
if job_status(g:job) != 'dead'