Mercurial > vim
annotate src/testdir/test_clientserver.vim @ 24458:1d126cb683c1 v8.2.2769
patch 8.2.2769: Modula-3 config files are not recognized
Commit: https://github.com/vim/vim/commit/6bc00699c5049c40761d212bef1b490e2af7944c
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Apr 15 14:29:17 2021 +0200
patch 8.2.2769: Modula-3 config files are not recognized
Problem: Modula-3 config files are not recognized.
Solution: Add filetype patterns. (Doug Kearns)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 15 Apr 2021 14:30:04 +0200 |
parents | 493870e7f61d |
children | 54a547489e49 |
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 |
17657
0da9bc55c31a
patch 8.1.1826: tests use hand coded feature and option checks
Bram Moolenaar <Bram@vim.org>
parents:
16965
diff
changeset
|
3 source check.vim |
0da9bc55c31a
patch 8.1.1826: tests use hand coded feature and option checks
Bram Moolenaar <Bram@vim.org>
parents:
16965
diff
changeset
|
4 CheckFeature job |
19932
2c4d9ca33769
patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents:
19906
diff
changeset
|
5 |
2c4d9ca33769
patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents:
19906
diff
changeset
|
6 if !has('clientserver') |
2c4d9ca33769
patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents:
19906
diff
changeset
|
7 call assert_fails('call remote_startserver("local")', 'E942:') |
2c4d9ca33769
patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents:
19906
diff
changeset
|
8 endif |
2c4d9ca33769
patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents:
19906
diff
changeset
|
9 |
17657
0da9bc55c31a
patch 8.1.1826: tests use hand coded feature and option checks
Bram Moolenaar <Bram@vim.org>
parents:
16965
diff
changeset
|
10 CheckFeature clientserver |
11175
9836b701afd9
patch 8.0.0474: the client-server feature is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
11 |
9836b701afd9
patch 8.0.0474: the client-server feature is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
12 source shared.vim |
9836b701afd9
patch 8.0.0474: the client-server feature is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
13 |
19906
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
19852
diff
changeset
|
14 func Check_X11_Connection() |
11250
ca5550f66b27
patch 8.0.0511: message for skipping client-server tests is unclear
Christian Brabandt <cb@256bit.org>
parents:
11242
diff
changeset
|
15 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
|
16 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
|
17 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
|
18 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
|
19 try |
9612b93820a4
patch 8.0.0507: client-server tests fail when $DISPLAY is not set
Christian Brabandt <cb@256bit.org>
parents:
11211
diff
changeset
|
20 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
|
21 catch |
9612b93820a4
patch 8.0.0507: client-server tests fail when $DISPLAY is not set
Christian Brabandt <cb@256bit.org>
parents:
11211
diff
changeset
|
22 if v:exception =~ 'E240:' |
19906
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
19852
diff
changeset
|
23 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
|
24 endif |
9612b93820a4
patch 8.0.0507: client-server tests fail when $DISPLAY is not set
Christian Brabandt <cb@256bit.org>
parents:
11211
diff
changeset
|
25 " 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
|
26 endtry |
9612b93820a4
patch 8.0.0507: client-server tests fail when $DISPLAY is not set
Christian Brabandt <cb@256bit.org>
parents:
11211
diff
changeset
|
27 endif |
19906
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
19852
diff
changeset
|
28 endfunc |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
19852
diff
changeset
|
29 |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
19852
diff
changeset
|
30 func Test_client_server() |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
19852
diff
changeset
|
31 let cmd = GetVimCommand() |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
19852
diff
changeset
|
32 if cmd == '' |
21765
08940efa6b4e
patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents:
21293
diff
changeset
|
33 throw 'GetVimCommand() failed' |
19906
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
19852
diff
changeset
|
34 endif |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
19852
diff
changeset
|
35 call Check_X11_Connection() |
11181
13544aa85dc0
patch 8.0.0477: the client-server test may hang when failing
Christian Brabandt <cb@256bit.org>
parents:
11177
diff
changeset
|
36 |
13544aa85dc0
patch 8.0.0477: the client-server test may hang when failing
Christian Brabandt <cb@256bit.org>
parents:
11177
diff
changeset
|
37 let name = 'XVIMTEST' |
11175
9836b701afd9
patch 8.0.0474: the client-server feature is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
38 let cmd .= ' --servername ' . name |
12765
c1347c968d31
patch 8.0.1260: using global variables for WaitFor()
Christian Brabandt <cb@256bit.org>
parents:
12746
diff
changeset
|
39 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
|
40 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
|
41 |
9836b701afd9
patch 8.0.0474: the client-server feature is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
42 " 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
|
43 " 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
|
44 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
|
45 |
24182
493870e7f61d
patch 8.2.2632: not all command line arguments are tested
Bram Moolenaar <Bram@vim.org>
parents:
23571
diff
changeset
|
46 if !has('win32') |
493870e7f61d
patch 8.2.2632: not all command line arguments are tested
Bram Moolenaar <Bram@vim.org>
parents:
23571
diff
changeset
|
47 if RunVim([], [], '--serverlist >Xtest_serverlist') |
493870e7f61d
patch 8.2.2632: not all command line arguments are tested
Bram Moolenaar <Bram@vim.org>
parents:
23571
diff
changeset
|
48 let lines = readfile('Xtest_serverlist') |
493870e7f61d
patch 8.2.2632: not all command line arguments are tested
Bram Moolenaar <Bram@vim.org>
parents:
23571
diff
changeset
|
49 call assert_true(index(lines, 'XVIMTEST') >= 0) |
493870e7f61d
patch 8.2.2632: not all command line arguments are tested
Bram Moolenaar <Bram@vim.org>
parents:
23571
diff
changeset
|
50 endif |
493870e7f61d
patch 8.2.2632: not all command line arguments are tested
Bram Moolenaar <Bram@vim.org>
parents:
23571
diff
changeset
|
51 call delete('Xtest_serverlist') |
493870e7f61d
patch 8.2.2632: not all command line arguments are tested
Bram Moolenaar <Bram@vim.org>
parents:
23571
diff
changeset
|
52 endif |
493870e7f61d
patch 8.2.2632: not all command line arguments are tested
Bram Moolenaar <Bram@vim.org>
parents:
23571
diff
changeset
|
53 |
17982
2029737e6a22
patch 8.1.1987: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17657
diff
changeset
|
54 eval name->remote_foreground() |
11175
9836b701afd9
patch 8.0.0474: the client-server feature is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
55 |
9836b701afd9
patch 8.0.0474: the client-server feature is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
56 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
|
57 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
|
58 call assert_equal('yes', remote_expr(name, "testvar", "", 2)) |
19852
12518b40c161
patch 8.2.0482: channel and sandbox code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19783
diff
changeset
|
59 call assert_fails("let x=remote_expr(name, '2+x')", 'E449:') |
12518b40c161
patch 8.2.0482: channel and sandbox code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19783
diff
changeset
|
60 call assert_fails("let x=remote_expr('[], '2+2')", 'E116:') |
11175
9836b701afd9
patch 8.0.0474: the client-server feature is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
61 |
11177
76fb679a310e
patch 8.0.0475: not enough testing for the client-server feature
Christian Brabandt <cb@256bit.org>
parents:
11175
diff
changeset
|
62 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
|
63 " 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
|
64 " 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
|
65 " 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
|
66 " 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
|
67 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
|
68 " 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
|
69 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
|
70 else |
71311d899b42
patch 8.0.0492: a failing client-server request can make Vim hang
Christian Brabandt <cb@256bit.org>
parents:
11185
diff
changeset
|
71 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
|
72 endif |
71311d899b42
patch 8.0.0492: a failing client-server request can make Vim hang
Christian Brabandt <cb@256bit.org>
parents:
11185
diff
changeset
|
73 " Wait for the server to be up and answering requests. |
22969
dcb59b1cc0c1
patch 8.2.2031: some tests fail when run under valgrind
Bram Moolenaar <Bram@vim.org>
parents:
22087
diff
changeset
|
74 " When using valgrind this can be very, very slow. |
dcb59b1cc0c1
patch 8.2.2031: some tests fail when run under valgrind
Bram Moolenaar <Bram@vim.org>
parents:
22087
diff
changeset
|
75 sleep 1 |
dcb59b1cc0c1
patch 8.2.2031: some tests fail when run under valgrind
Bram Moolenaar <Bram@vim.org>
parents:
22087
diff
changeset
|
76 call WaitForAssert({-> assert_match('\d', name->remote_expr("v:version", "", 1))}, 10000) |
11211
71311d899b42
patch 8.0.0492: a failing client-server request can make Vim hang
Christian Brabandt <cb@256bit.org>
parents:
11185
diff
changeset
|
77 |
11177
76fb679a310e
patch 8.0.0475: not enough testing for the client-server feature
Christian Brabandt <cb@256bit.org>
parents:
11175
diff
changeset
|
78 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
|
79 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
|
80 endif |
76fb679a310e
patch 8.0.0475: not enough testing for the client-server feature
Christian Brabandt <cb@256bit.org>
parents:
11175
diff
changeset
|
81 |
22087
ff21e2962490
patch 8.2.1593: tests do not check the error number properly
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
82 call assert_fails('call remote_send("XXX", ":let testvar = ''yes''\<CR>")', 'E241:') |
11177
76fb679a310e
patch 8.0.0475: not enough testing for the client-server feature
Christian Brabandt <cb@256bit.org>
parents:
11175
diff
changeset
|
83 |
23376
0d79d18f1c69
patch 8.2.2231: when "--remote file" is used "file" is not reloaded
Bram Moolenaar <Bram@vim.org>
parents:
22969
diff
changeset
|
84 call writefile(['one'], 'Xclientfile') |
0d79d18f1c69
patch 8.2.2231: when "--remote file" is used "file" is not reloaded
Bram Moolenaar <Bram@vim.org>
parents:
22969
diff
changeset
|
85 let cmd = GetVimProg() .. ' --servername ' .. name .. ' --remote Xclientfile' |
0d79d18f1c69
patch 8.2.2231: when "--remote file" is used "file" is not reloaded
Bram Moolenaar <Bram@vim.org>
parents:
22969
diff
changeset
|
86 call system(cmd) |
0d79d18f1c69
patch 8.2.2231: when "--remote file" is used "file" is not reloaded
Bram Moolenaar <Bram@vim.org>
parents:
22969
diff
changeset
|
87 call WaitForAssert({-> assert_equal('Xclientfile', remote_expr(name, "bufname()", "", 2))}) |
0d79d18f1c69
patch 8.2.2231: when "--remote file" is used "file" is not reloaded
Bram Moolenaar <Bram@vim.org>
parents:
22969
diff
changeset
|
88 call WaitForAssert({-> assert_equal('one', remote_expr(name, "getline(1)", "", 2))}) |
0d79d18f1c69
patch 8.2.2231: when "--remote file" is used "file" is not reloaded
Bram Moolenaar <Bram@vim.org>
parents:
22969
diff
changeset
|
89 call writefile(['one', 'two'], 'Xclientfile') |
0d79d18f1c69
patch 8.2.2231: when "--remote file" is used "file" is not reloaded
Bram Moolenaar <Bram@vim.org>
parents:
22969
diff
changeset
|
90 call system(cmd) |
0d79d18f1c69
patch 8.2.2231: when "--remote file" is used "file" is not reloaded
Bram Moolenaar <Bram@vim.org>
parents:
22969
diff
changeset
|
91 call WaitForAssert({-> assert_equal('two', remote_expr(name, "getline(2)", "", 2))}) |
23571
b02ac00aacbf
patch 8.2.2328: some test files may not be deleted
Bram Moolenaar <Bram@vim.org>
parents:
23394
diff
changeset
|
92 call delete('Xclientfile') |
23376
0d79d18f1c69
patch 8.2.2231: when "--remote file" is used "file" is not reloaded
Bram Moolenaar <Bram@vim.org>
parents:
22969
diff
changeset
|
93 |
11177
76fb679a310e
patch 8.0.0475: not enough testing for the client-server feature
Christian Brabandt <cb@256bit.org>
parents:
11175
diff
changeset
|
94 " 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
|
95 if v:servername == '' |
17982
2029737e6a22
patch 8.1.1987: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17657
diff
changeset
|
96 eval 'MYSELF'->remote_startserver() |
11211
71311d899b42
patch 8.0.0492: a failing client-server request can make Vim hang
Christian Brabandt <cb@256bit.org>
parents:
11185
diff
changeset
|
97 " 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
|
98 call assert_match('MYSELF', v:servername) |
19852
12518b40c161
patch 8.2.0482: channel and sandbox code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19783
diff
changeset
|
99 call assert_fails("call remote_startserver('MYSELF')", 'E941:') |
11177
76fb679a310e
patch 8.0.0475: not enough testing for the client-server feature
Christian Brabandt <cb@256bit.org>
parents:
11175
diff
changeset
|
100 endif |
76fb679a310e
patch 8.0.0475: not enough testing for the client-server feature
Christian Brabandt <cb@256bit.org>
parents:
11175
diff
changeset
|
101 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
|
102 call assert_equal('myself', remote_expr(v:servername, 'testvar')) |
19906
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
19852
diff
changeset
|
103 call remote_send(v:servername, ":let g:testvar2 = 75\<CR>") |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
19852
diff
changeset
|
104 call feedkeys('', 'x') |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
19852
diff
changeset
|
105 call assert_equal(75, g:testvar2) |
21265
6a4806e326dd
patch 8.2.1183: assert_fails() checks the last error message
Bram Moolenaar <Bram@vim.org>
parents:
20178
diff
changeset
|
106 call assert_fails('let v = remote_expr(v:servername, "/2")', ['E15:.*/2']) |
11177
76fb679a310e
patch 8.0.0475: not enough testing for the client-server feature
Christian Brabandt <cb@256bit.org>
parents:
11175
diff
changeset
|
107 |
76fb679a310e
patch 8.0.0475: not enough testing for the client-server feature
Christian Brabandt <cb@256bit.org>
parents:
11175
diff
changeset
|
108 call remote_send(name, ":call server2client(expand('<client>'), 'got it')\<CR>", 'g:myserverid') |
17982
2029737e6a22
patch 8.1.1987: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17657
diff
changeset
|
109 call assert_equal('got it', g:myserverid->remote_read(2)) |
11177
76fb679a310e
patch 8.0.0475: not enough testing for the client-server feature
Christian Brabandt <cb@256bit.org>
parents:
11175
diff
changeset
|
110 |
17994
0dcc2ee838dd
patch 8.1.1993: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17982
diff
changeset
|
111 call remote_send(name, ":eval expand('<client>')->server2client('another')\<CR>", 'g:myserverid') |
11185
eb050472e4b4
patch 8.0.0479: remote_peek() is not tested
Christian Brabandt <cb@256bit.org>
parents:
11181
diff
changeset
|
112 let peek_result = 'nothing' |
17982
2029737e6a22
patch 8.1.1987: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17657
diff
changeset
|
113 let r = g:myserverid->remote_peek('peek_result') |
12765
c1347c968d31
patch 8.0.1260: using global variables for WaitFor()
Christian Brabandt <cb@256bit.org>
parents:
12746
diff
changeset
|
114 " 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
|
115 if r > 0 |
eb050472e4b4
patch 8.0.0479: remote_peek() is not tested
Christian Brabandt <cb@256bit.org>
parents:
11181
diff
changeset
|
116 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
|
117 elseif r == 0 |
eb050472e4b4
patch 8.0.0479: remote_peek() is not tested
Christian Brabandt <cb@256bit.org>
parents:
11181
diff
changeset
|
118 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
|
119 else |
eb050472e4b4
patch 8.0.0479: remote_peek() is not tested
Christian Brabandt <cb@256bit.org>
parents:
11181
diff
changeset
|
120 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
|
121 endif |
eb050472e4b4
patch 8.0.0479: remote_peek() is not tested
Christian Brabandt <cb@256bit.org>
parents:
11181
diff
changeset
|
122 let g:peek_result = 'empty' |
eb050472e4b4
patch 8.0.0479: remote_peek() is not tested
Christian Brabandt <cb@256bit.org>
parents:
11181
diff
changeset
|
123 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
|
124 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
|
125 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
|
126 |
19906
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
19852
diff
changeset
|
127 if !has('gui_running') |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
19852
diff
changeset
|
128 " In GUI vim, the following tests display a dialog box |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
19852
diff
changeset
|
129 |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
19852
diff
changeset
|
130 let cmd = GetVimProg() .. ' --servername ' .. name |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
19852
diff
changeset
|
131 |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
19852
diff
changeset
|
132 " Run a separate instance to send a command to the server |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
19852
diff
changeset
|
133 call remote_expr(name, 'execute("only")') |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
19852
diff
changeset
|
134 call system(cmd .. ' --remote-send ":new Xfile<CR>"') |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
19852
diff
changeset
|
135 call assert_equal('2', remote_expr(name, 'winnr("$")')) |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
19852
diff
changeset
|
136 call assert_equal('Xfile', remote_expr(name, 'winbufnr(1)->bufname()')) |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
19852
diff
changeset
|
137 call remote_expr(name, 'execute("only")') |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
19852
diff
changeset
|
138 |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
19852
diff
changeset
|
139 " Invoke a remote-expr. On MS-Windows, the returned value has a carriage |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
19852
diff
changeset
|
140 " return. |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
19852
diff
changeset
|
141 let l = system(cmd .. ' --remote-expr "2 + 2"') |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
19852
diff
changeset
|
142 call assert_equal(['4'], split(l, "\n")) |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
19852
diff
changeset
|
143 |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
19852
diff
changeset
|
144 " Edit multiple files using --remote |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
19852
diff
changeset
|
145 call system(cmd .. ' --remote Xfile1 Xfile2 Xfile3') |
23394
0098b94e5d08
patch 8.2.2240: clientserver test fails if full path is used
Bram Moolenaar <Bram@vim.org>
parents:
23376
diff
changeset
|
146 call assert_match(".*Xfile1\n.*Xfile2\n.*Xfile3\n", remote_expr(name, 'argv()')) |
19906
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
19852
diff
changeset
|
147 eval name->remote_send(":%bw!\<CR>") |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
19852
diff
changeset
|
148 |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
19852
diff
changeset
|
149 " Edit files in separate tab pages |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
19852
diff
changeset
|
150 call system(cmd .. ' --remote-tab Xfile1 Xfile2 Xfile3') |
19956
ea0ff06dccba
patch 8.2.0534: client-server test fails under valgrind
Bram Moolenaar <Bram@vim.org>
parents:
19932
diff
changeset
|
151 call WaitForAssert({-> assert_equal('3', remote_expr(name, 'tabpagenr("$")'))}) |
23394
0098b94e5d08
patch 8.2.2240: clientserver test fails if full path is used
Bram Moolenaar <Bram@vim.org>
parents:
23376
diff
changeset
|
152 call assert_match('.*\<Xfile2', remote_expr(name, 'bufname(tabpagebuflist(2)[0])')) |
19906
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
19852
diff
changeset
|
153 eval name->remote_send(":%bw!\<CR>") |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
19852
diff
changeset
|
154 |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
19852
diff
changeset
|
155 " Edit a file using --remote-wait |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
19852
diff
changeset
|
156 eval name->remote_send(":source $VIMRUNTIME/plugin/rrhelper.vim\<CR>") |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
19852
diff
changeset
|
157 call system(cmd .. ' --remote-wait +enew Xfile1') |
23394
0098b94e5d08
patch 8.2.2240: clientserver test fails if full path is used
Bram Moolenaar <Bram@vim.org>
parents:
23376
diff
changeset
|
158 call assert_match('.*\<Xfile1', remote_expr(name, 'bufname("#")')) |
19906
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
19852
diff
changeset
|
159 eval name->remote_send(":%bw!\<CR>") |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
19852
diff
changeset
|
160 |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
19852
diff
changeset
|
161 " Edit files using --remote-tab-wait |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
19852
diff
changeset
|
162 call system(cmd .. ' --remote-tabwait +tabonly\|enew Xfile1 Xfile2') |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
19852
diff
changeset
|
163 call assert_equal('1', remote_expr(name, 'tabpagenr("$")')) |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
19852
diff
changeset
|
164 eval name->remote_send(":%bw!\<CR>") |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
19852
diff
changeset
|
165 |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
19852
diff
changeset
|
166 " Error cases |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
19852
diff
changeset
|
167 if v:lang == "C" || v:lang =~ '^[Ee]n' |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
19852
diff
changeset
|
168 let l = split(system(cmd .. ' --remote +pwd'), "\n") |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
19852
diff
changeset
|
169 call assert_equal("Argument missing after: \"+pwd\"", l[1]) |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
19852
diff
changeset
|
170 endif |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
19852
diff
changeset
|
171 let l = system(cmd .. ' --remote-expr "abcd"') |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
19852
diff
changeset
|
172 call assert_match('^E449: ', l) |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
19852
diff
changeset
|
173 endif |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
19852
diff
changeset
|
174 |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
19852
diff
changeset
|
175 eval name->remote_send(":%bw!\<CR>") |
17982
2029737e6a22
patch 8.1.1987: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17657
diff
changeset
|
176 eval name->remote_send(":qa!\<CR>") |
12765
c1347c968d31
patch 8.0.1260: using global variables for WaitFor()
Christian Brabandt <cb@256bit.org>
parents:
12746
diff
changeset
|
177 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
|
178 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
|
179 finally |
c1347c968d31
patch 8.0.1260: using global variables for WaitFor()
Christian Brabandt <cb@256bit.org>
parents:
12746
diff
changeset
|
180 if job_status(job) != 'dead' |
c1347c968d31
patch 8.0.1260: using global variables for WaitFor()
Christian Brabandt <cb@256bit.org>
parents:
12746
diff
changeset
|
181 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
|
182 call job_stop(job, 'kill') |
c1347c968d31
patch 8.0.1260: using global variables for WaitFor()
Christian Brabandt <cb@256bit.org>
parents:
12746
diff
changeset
|
183 endif |
c1347c968d31
patch 8.0.1260: using global variables for WaitFor()
Christian Brabandt <cb@256bit.org>
parents:
12746
diff
changeset
|
184 endtry |
19783
546bdeef35f1
patch 8.2.0448: various functions not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
17994
diff
changeset
|
185 |
20178
2fb397573541
patch 8.2.0644: insufficient testing for invalid function arguments
Bram Moolenaar <Bram@vim.org>
parents:
19956
diff
changeset
|
186 call assert_fails('call remote_startserver([])', 'E730:') |
19906
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
19852
diff
changeset
|
187 call assert_fails("let x = remote_peek([])", 'E730:') |
21289
37f404a13623
patch 8.2.1195: clientserver test fails on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents:
21265
diff
changeset
|
188 call assert_fails("let x = remote_read('vim10')", |
21293
6dff32278cd8
patch 8.2.1197: clientserver test still fails on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents:
21289
diff
changeset
|
189 \ has('unix') ? ['E573:.*vim10'] : 'E277:') |
21289
37f404a13623
patch 8.2.1195: clientserver test fails on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents:
21265
diff
changeset
|
190 call assert_fails("call server2client('abc', 'xyz')", |
21293
6dff32278cd8
patch 8.2.1197: clientserver test still fails on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents:
21289
diff
changeset
|
191 \ has('unix') ? ['E573:.*abc'] : 'E258:') |
11175
9836b701afd9
patch 8.0.0474: the client-server feature is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
192 endfunc |
9836b701afd9
patch 8.0.0474: the client-server feature is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
193 |
9836b701afd9
patch 8.0.0474: the client-server feature is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
194 " 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
|
195 " call ch_logfile('channellog', 'w') |
19783
546bdeef35f1
patch 8.2.0448: various functions not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
17994
diff
changeset
|
196 |
546bdeef35f1
patch 8.2.0448: various functions not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
17994
diff
changeset
|
197 " vim: shiftwidth=2 sts=2 expandtab |