Mercurial > vim
annotate src/testdir/test_clientserver.vim @ 15400:ac5542aadd9c v8.1.0708
patch 8.1.0708: third argument for redrawWinline() is always FALSE
commit https://github.com/vim/vim/commit/ae12f4bad306a1a3a2d54ff6ed76df9b11d19469
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Jan 9 20:51:04 2019 +0100
patch 8.1.0708: third argument for redrawWinline() is always FALSE
Problem: Third argument for redrawWinline() is always FALSE.
Solution: Drop the argument. (neovim https://github.com/vim/vim/issues/9479)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 09 Jan 2019 21:00:07 +0100 |
parents | 415185e2c970 |
children | ba7727889385 |
rev | line source |
---|---|
11175
9836b701afd9
patch 8.0.0474: the client-server feature is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1 " Tests for the +clientserver feature. |
9836b701afd9
patch 8.0.0474: the client-server feature is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2 |
9836b701afd9
patch 8.0.0474: the client-server feature is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3 if !has('job') || !has('clientserver') |
9836b701afd9
patch 8.0.0474: the client-server feature is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4 finish |
9836b701afd9
patch 8.0.0474: the client-server feature is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5 endif |
9836b701afd9
patch 8.0.0474: the client-server feature is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6 |
9836b701afd9
patch 8.0.0474: the client-server feature is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7 source shared.vim |
9836b701afd9
patch 8.0.0474: the client-server feature is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8 |
9836b701afd9
patch 8.0.0474: the client-server feature is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
9 func Test_client_server() |
9836b701afd9
patch 8.0.0474: the client-server feature is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
10 let cmd = GetVimCommand() |
9836b701afd9
patch 8.0.0474: the client-server feature is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
11 if cmd == '' |
9836b701afd9
patch 8.0.0474: the client-server feature is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
12 return |
9836b701afd9
patch 8.0.0474: the client-server feature is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
13 endif |
11250
ca5550f66b27
patch 8.0.0511: message for skipping client-server tests is unclear
Christian Brabandt <cb@256bit.org>
parents:
11242
diff
changeset
|
14 if has('x11') |
ca5550f66b27
patch 8.0.0511: message for skipping client-server tests is unclear
Christian Brabandt <cb@256bit.org>
parents:
11242
diff
changeset
|
15 if empty($DISPLAY) |
ca5550f66b27
patch 8.0.0511: message for skipping client-server tests is unclear
Christian Brabandt <cb@256bit.org>
parents:
11242
diff
changeset
|
16 throw 'Skipped: $DISPLAY is not set' |
ca5550f66b27
patch 8.0.0511: message for skipping client-server tests is unclear
Christian Brabandt <cb@256bit.org>
parents:
11242
diff
changeset
|
17 endif |
11242
9612b93820a4
patch 8.0.0507: client-server tests fail when $DISPLAY is not set
Christian Brabandt <cb@256bit.org>
parents:
11211
diff
changeset
|
18 try |
9612b93820a4
patch 8.0.0507: client-server tests fail when $DISPLAY is not set
Christian Brabandt <cb@256bit.org>
parents:
11211
diff
changeset
|
19 call remote_send('xxx', '') |
9612b93820a4
patch 8.0.0507: client-server tests fail when $DISPLAY is not set
Christian Brabandt <cb@256bit.org>
parents:
11211
diff
changeset
|
20 catch |
9612b93820a4
patch 8.0.0507: client-server tests fail when $DISPLAY is not set
Christian Brabandt <cb@256bit.org>
parents:
11211
diff
changeset
|
21 if v:exception =~ 'E240:' |
11250
ca5550f66b27
patch 8.0.0511: message for skipping client-server tests is unclear
Christian Brabandt <cb@256bit.org>
parents:
11242
diff
changeset
|
22 throw 'Skipped: no connection to the X server' |
11242
9612b93820a4
patch 8.0.0507: client-server tests fail when $DISPLAY is not set
Christian Brabandt <cb@256bit.org>
parents:
11211
diff
changeset
|
23 endif |
9612b93820a4
patch 8.0.0507: client-server tests fail when $DISPLAY is not set
Christian Brabandt <cb@256bit.org>
parents:
11211
diff
changeset
|
24 " ignore other errors |
9612b93820a4
patch 8.0.0507: client-server tests fail when $DISPLAY is not set
Christian Brabandt <cb@256bit.org>
parents:
11211
diff
changeset
|
25 endtry |
9612b93820a4
patch 8.0.0507: client-server tests fail when $DISPLAY is not set
Christian Brabandt <cb@256bit.org>
parents:
11211
diff
changeset
|
26 endif |
11181
13544aa85dc0
patch 8.0.0477: the client-server test may hang when failing
Christian Brabandt <cb@256bit.org>
parents:
11177
diff
changeset
|
27 |
13544aa85dc0
patch 8.0.0477: the client-server test may hang when failing
Christian Brabandt <cb@256bit.org>
parents:
11177
diff
changeset
|
28 let name = 'XVIMTEST' |
11175
9836b701afd9
patch 8.0.0474: the client-server feature is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
29 let cmd .= ' --servername ' . name |
12765
c1347c968d31
patch 8.0.1260: using global variables for WaitFor()
Christian Brabandt <cb@256bit.org>
parents:
12746
diff
changeset
|
30 let job = job_start(cmd, {'stoponexit': 'kill', 'out_io': 'null'}) |
13798
415185e2c970
patch 8.0.1771: in tests, when WaitFor() fails it doesn't say why
Christian Brabandt <cb@256bit.org>
parents:
13650
diff
changeset
|
31 call WaitForAssert({-> assert_equal("run", job_status(job))}) |
11175
9836b701afd9
patch 8.0.0474: the client-server feature is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
32 |
9836b701afd9
patch 8.0.0474: the client-server feature is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
33 " Takes a short while for the server to be active. |
12405
6ef5e636f246
patch 8.0.1082: tests fail when run under valgrind
Christian Brabandt <cb@256bit.org>
parents:
11500
diff
changeset
|
34 " When using valgrind it takes much longer. |
13798
415185e2c970
patch 8.0.1771: in tests, when WaitFor() fails it doesn't say why
Christian Brabandt <cb@256bit.org>
parents:
13650
diff
changeset
|
35 call WaitForAssert({-> assert_match(name, serverlist())}) |
11175
9836b701afd9
patch 8.0.0474: the client-server feature is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
36 |
9836b701afd9
patch 8.0.0474: the client-server feature is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
37 call remote_foreground(name) |
9836b701afd9
patch 8.0.0474: the client-server feature is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
38 |
9836b701afd9
patch 8.0.0474: the client-server feature is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
39 call remote_send(name, ":let testvar = 'yes'\<CR>") |
12746
27eee6528b3d
patch 8.0.1251: invalid expressin passed to WaitFor()
Christian Brabandt <cb@256bit.org>
parents:
12405
diff
changeset
|
40 call WaitFor('remote_expr("' . name . '", "exists(\"testvar\") ? testvar : \"\"", "", 1) == "yes"') |
11211
71311d899b42
patch 8.0.0492: a failing client-server request can make Vim hang
Christian Brabandt <cb@256bit.org>
parents:
11185
diff
changeset
|
41 call assert_equal('yes', remote_expr(name, "testvar", "", 2)) |
11175
9836b701afd9
patch 8.0.0474: the client-server feature is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
42 |
11177
76fb679a310e
patch 8.0.0475: not enough testing for the client-server feature
Christian Brabandt <cb@256bit.org>
parents:
11175
diff
changeset
|
43 if has('unix') && has('gui') && !has('gui_running') |
11500
f0d050a452c5
patch 8.0.0633: the client-server test is still a bit flaky
Christian Brabandt <cb@256bit.org>
parents:
11250
diff
changeset
|
44 " Running in a terminal and the GUI is available: Tell the server to open |
11177
76fb679a310e
patch 8.0.0475: not enough testing for the client-server feature
Christian Brabandt <cb@256bit.org>
parents:
11175
diff
changeset
|
45 " the GUI and check that the remote command still works. |
76fb679a310e
patch 8.0.0475: not enough testing for the client-server feature
Christian Brabandt <cb@256bit.org>
parents:
11175
diff
changeset
|
46 " Need to wait for the GUI to start up, otherwise the send hangs in trying |
76fb679a310e
patch 8.0.0475: not enough testing for the client-server feature
Christian Brabandt <cb@256bit.org>
parents:
11175
diff
changeset
|
47 " to send to the terminal window. |
11211
71311d899b42
patch 8.0.0492: a failing client-server request can make Vim hang
Christian Brabandt <cb@256bit.org>
parents:
11185
diff
changeset
|
48 if has('gui_athena') || has('gui_motif') |
71311d899b42
patch 8.0.0492: a failing client-server request can make Vim hang
Christian Brabandt <cb@256bit.org>
parents:
11185
diff
changeset
|
49 " For those GUIs, ignore the 'failed to create input context' error. |
71311d899b42
patch 8.0.0492: a failing client-server request can make Vim hang
Christian Brabandt <cb@256bit.org>
parents:
11185
diff
changeset
|
50 call remote_send(name, ":call test_ignore_error('E285') | gui -f\<CR>") |
71311d899b42
patch 8.0.0492: a failing client-server request can make Vim hang
Christian Brabandt <cb@256bit.org>
parents:
11185
diff
changeset
|
51 else |
71311d899b42
patch 8.0.0492: a failing client-server request can make Vim hang
Christian Brabandt <cb@256bit.org>
parents:
11185
diff
changeset
|
52 call remote_send(name, ":gui -f\<CR>") |
71311d899b42
patch 8.0.0492: a failing client-server request can make Vim hang
Christian Brabandt <cb@256bit.org>
parents:
11185
diff
changeset
|
53 endif |
71311d899b42
patch 8.0.0492: a failing client-server request can make Vim hang
Christian Brabandt <cb@256bit.org>
parents:
11185
diff
changeset
|
54 " Wait for the server to be up and answering requests. |
11500
f0d050a452c5
patch 8.0.0633: the client-server test is still a bit flaky
Christian Brabandt <cb@256bit.org>
parents:
11250
diff
changeset
|
55 sleep 100m |
13798
415185e2c970
patch 8.0.1771: in tests, when WaitFor() fails it doesn't say why
Christian Brabandt <cb@256bit.org>
parents:
13650
diff
changeset
|
56 call WaitForAssert({-> assert_true(remote_expr(name, "v:version", "", 1) != "")}) |
11211
71311d899b42
patch 8.0.0492: a failing client-server request can make Vim hang
Christian Brabandt <cb@256bit.org>
parents:
11185
diff
changeset
|
57 |
11177
76fb679a310e
patch 8.0.0475: not enough testing for the client-server feature
Christian Brabandt <cb@256bit.org>
parents:
11175
diff
changeset
|
58 call remote_send(name, ":let testvar = 'maybe'\<CR>") |
13798
415185e2c970
patch 8.0.1771: in tests, when WaitFor() fails it doesn't say why
Christian Brabandt <cb@256bit.org>
parents:
13650
diff
changeset
|
59 call WaitForAssert({-> assert_equal('maybe', remote_expr(name, "testvar", "", 2))}) |
11177
76fb679a310e
patch 8.0.0475: not enough testing for the client-server feature
Christian Brabandt <cb@256bit.org>
parents:
11175
diff
changeset
|
60 endif |
76fb679a310e
patch 8.0.0475: not enough testing for the client-server feature
Christian Brabandt <cb@256bit.org>
parents:
11175
diff
changeset
|
61 |
76fb679a310e
patch 8.0.0475: not enough testing for the client-server feature
Christian Brabandt <cb@256bit.org>
parents:
11175
diff
changeset
|
62 call assert_fails('call remote_send("XXX", ":let testvar = ''yes''\<CR>")', 'E241') |
76fb679a310e
patch 8.0.0475: not enough testing for the client-server feature
Christian Brabandt <cb@256bit.org>
parents:
11175
diff
changeset
|
63 |
76fb679a310e
patch 8.0.0475: not enough testing for the client-server feature
Christian Brabandt <cb@256bit.org>
parents:
11175
diff
changeset
|
64 " Expression evaluated locally. |
76fb679a310e
patch 8.0.0475: not enough testing for the client-server feature
Christian Brabandt <cb@256bit.org>
parents:
11175
diff
changeset
|
65 if v:servername == '' |
76fb679a310e
patch 8.0.0475: not enough testing for the client-server feature
Christian Brabandt <cb@256bit.org>
parents:
11175
diff
changeset
|
66 call remote_startserver('MYSELF') |
11211
71311d899b42
patch 8.0.0492: a failing client-server request can make Vim hang
Christian Brabandt <cb@256bit.org>
parents:
11185
diff
changeset
|
67 " May get MYSELF1 when running the test again. |
71311d899b42
patch 8.0.0492: a failing client-server request can make Vim hang
Christian Brabandt <cb@256bit.org>
parents:
11185
diff
changeset
|
68 call assert_match('MYSELF', v:servername) |
11177
76fb679a310e
patch 8.0.0475: not enough testing for the client-server feature
Christian Brabandt <cb@256bit.org>
parents:
11175
diff
changeset
|
69 endif |
76fb679a310e
patch 8.0.0475: not enough testing for the client-server feature
Christian Brabandt <cb@256bit.org>
parents:
11175
diff
changeset
|
70 let g:testvar = 'myself' |
76fb679a310e
patch 8.0.0475: not enough testing for the client-server feature
Christian Brabandt <cb@256bit.org>
parents:
11175
diff
changeset
|
71 call assert_equal('myself', remote_expr(v:servername, 'testvar')) |
76fb679a310e
patch 8.0.0475: not enough testing for the client-server feature
Christian Brabandt <cb@256bit.org>
parents:
11175
diff
changeset
|
72 |
76fb679a310e
patch 8.0.0475: not enough testing for the client-server feature
Christian Brabandt <cb@256bit.org>
parents:
11175
diff
changeset
|
73 call remote_send(name, ":call server2client(expand('<client>'), 'got it')\<CR>", 'g:myserverid') |
11211
71311d899b42
patch 8.0.0492: a failing client-server request can make Vim hang
Christian Brabandt <cb@256bit.org>
parents:
11185
diff
changeset
|
74 call assert_equal('got it', remote_read(g:myserverid, 2)) |
11177
76fb679a310e
patch 8.0.0475: not enough testing for the client-server feature
Christian Brabandt <cb@256bit.org>
parents:
11175
diff
changeset
|
75 |
11185
eb050472e4b4
patch 8.0.0479: remote_peek() is not tested
Christian Brabandt <cb@256bit.org>
parents:
11181
diff
changeset
|
76 call remote_send(name, ":call server2client(expand('<client>'), 'another')\<CR>", 'g:myserverid') |
eb050472e4b4
patch 8.0.0479: remote_peek() is not tested
Christian Brabandt <cb@256bit.org>
parents:
11181
diff
changeset
|
77 let peek_result = 'nothing' |
eb050472e4b4
patch 8.0.0479: remote_peek() is not tested
Christian Brabandt <cb@256bit.org>
parents:
11181
diff
changeset
|
78 let r = remote_peek(g:myserverid, 'peek_result') |
12765
c1347c968d31
patch 8.0.1260: using global variables for WaitFor()
Christian Brabandt <cb@256bit.org>
parents:
12746
diff
changeset
|
79 " unpredictable whether the result is already available. |
11185
eb050472e4b4
patch 8.0.0479: remote_peek() is not tested
Christian Brabandt <cb@256bit.org>
parents:
11181
diff
changeset
|
80 if r > 0 |
eb050472e4b4
patch 8.0.0479: remote_peek() is not tested
Christian Brabandt <cb@256bit.org>
parents:
11181
diff
changeset
|
81 call assert_equal('another', peek_result) |
eb050472e4b4
patch 8.0.0479: remote_peek() is not tested
Christian Brabandt <cb@256bit.org>
parents:
11181
diff
changeset
|
82 elseif r == 0 |
eb050472e4b4
patch 8.0.0479: remote_peek() is not tested
Christian Brabandt <cb@256bit.org>
parents:
11181
diff
changeset
|
83 call assert_equal('nothing', peek_result) |
eb050472e4b4
patch 8.0.0479: remote_peek() is not tested
Christian Brabandt <cb@256bit.org>
parents:
11181
diff
changeset
|
84 else |
eb050472e4b4
patch 8.0.0479: remote_peek() is not tested
Christian Brabandt <cb@256bit.org>
parents:
11181
diff
changeset
|
85 call assert_report('remote_peek() failed') |
eb050472e4b4
patch 8.0.0479: remote_peek() is not tested
Christian Brabandt <cb@256bit.org>
parents:
11181
diff
changeset
|
86 endif |
eb050472e4b4
patch 8.0.0479: remote_peek() is not tested
Christian Brabandt <cb@256bit.org>
parents:
11181
diff
changeset
|
87 let g:peek_result = 'empty' |
eb050472e4b4
patch 8.0.0479: remote_peek() is not tested
Christian Brabandt <cb@256bit.org>
parents:
11181
diff
changeset
|
88 call WaitFor('remote_peek(g:myserverid, "g:peek_result") > 0') |
eb050472e4b4
patch 8.0.0479: remote_peek() is not tested
Christian Brabandt <cb@256bit.org>
parents:
11181
diff
changeset
|
89 call assert_equal('another', g:peek_result) |
11211
71311d899b42
patch 8.0.0492: a failing client-server request can make Vim hang
Christian Brabandt <cb@256bit.org>
parents:
11185
diff
changeset
|
90 call assert_equal('another', remote_read(g:myserverid, 2)) |
11185
eb050472e4b4
patch 8.0.0479: remote_peek() is not tested
Christian Brabandt <cb@256bit.org>
parents:
11181
diff
changeset
|
91 |
11175
9836b701afd9
patch 8.0.0474: the client-server feature is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
92 call remote_send(name, ":qa!\<CR>") |
12765
c1347c968d31
patch 8.0.1260: using global variables for WaitFor()
Christian Brabandt <cb@256bit.org>
parents:
12746
diff
changeset
|
93 try |
13798
415185e2c970
patch 8.0.1771: in tests, when WaitFor() fails it doesn't say why
Christian Brabandt <cb@256bit.org>
parents:
13650
diff
changeset
|
94 call WaitForAssert({-> assert_equal("dead", job_status(job))}) |
12765
c1347c968d31
patch 8.0.1260: using global variables for WaitFor()
Christian Brabandt <cb@256bit.org>
parents:
12746
diff
changeset
|
95 finally |
c1347c968d31
patch 8.0.1260: using global variables for WaitFor()
Christian Brabandt <cb@256bit.org>
parents:
12746
diff
changeset
|
96 if job_status(job) != 'dead' |
c1347c968d31
patch 8.0.1260: using global variables for WaitFor()
Christian Brabandt <cb@256bit.org>
parents:
12746
diff
changeset
|
97 call assert_report('Server did not exit') |
c1347c968d31
patch 8.0.1260: using global variables for WaitFor()
Christian Brabandt <cb@256bit.org>
parents:
12746
diff
changeset
|
98 call job_stop(job, 'kill') |
c1347c968d31
patch 8.0.1260: using global variables for WaitFor()
Christian Brabandt <cb@256bit.org>
parents:
12746
diff
changeset
|
99 endif |
c1347c968d31
patch 8.0.1260: using global variables for WaitFor()
Christian Brabandt <cb@256bit.org>
parents:
12746
diff
changeset
|
100 endtry |
11175
9836b701afd9
patch 8.0.0474: the client-server feature is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
101 endfunc |
9836b701afd9
patch 8.0.0474: the client-server feature is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
102 |
9836b701afd9
patch 8.0.0474: the client-server feature is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
103 " Uncomment this line to get a debugging log |
9836b701afd9
patch 8.0.0474: the client-server feature is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
104 " call ch_logfile('channellog', 'w') |