comparison src/testdir/test_clientserver.vim @ 11175:9836b701afd9 v8.0.0474

patch 8.0.0474: the client-server feature is not tested commit https://github.com/vim/vim/commit/15bf76d40be1f1622ff5cc16596c308e76e2ca94 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Mar 18 16:18:37 2017 +0100 patch 8.0.0474: the client-server feature is not tested Problem: The client-server feature is not tested. Solution: Add a test.
author Christian Brabandt <cb@256bit.org>
date Sat, 18 Mar 2017 16:30:04 +0100
parents
children 76fb679a310e
comparison
equal deleted inserted replaced
11174:1b3fe8c81a43 11175:9836b701afd9
1 " Tests for the +clientserver feature.
2
3 if !has('job') || !has('clientserver')
4 finish
5 endif
6
7 source shared.vim
8
9 func Test_client_server()
10 let cmd = GetVimCommand()
11 if cmd == ''
12 return
13 endif
14 let name = 'XVIMTEXT'
15 let cmd .= ' --servername ' . name
16 let g:job = job_start(cmd, {'stoponexit': 'kill', 'out_io': 'null'})
17 call WaitFor('job_status(g:job) == "run"')
18 if job_status(g:job) != 'run'
19 call assert_true(0, 'Cannot run the Vim server')
20 return
21 endif
22
23 " Takes a short while for the server to be active.
24 call WaitFor('serverlist() =~ "' . name . '"')
25 call assert_match(name, serverlist())
26
27 call remote_foreground(name)
28
29 call remote_send(name, ":let testvar = 'yes'\<CR>")
30 call WaitFor('remote_expr("' . name . '", "testvar") == "yes"')
31 call assert_equal('yes', remote_expr(name, "testvar"))
32
33 call remote_send(name, ":qa!\<CR>")
34 call WaitFor('job_status(g:job) == "dead"')
35 if job_status(g:job) != 'dead'
36 call assert_true(0, 'Server did not exit')
37 call job_stop(g:job, 'kill')
38 endif
39 endfunc
40
41 " Uncomment this line to get a debugging log
42 " call ch_logfile('channellog', 'w')