Mercurial > vim
view src/testdir/test_clientserver.vim @ 11193:75ccc8a15a51 v8.0.0483
patch 8.0.0483: illegal memory access when using :all
commit https://github.com/vim/vim/commit/f79225ed4f81bc579bb3360ad2eb06adc8058153
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Mar 18 23:11:04 2017 +0100
patch 8.0.0483: illegal memory access when using :all
Problem: Illegal memory access when using :all. (Dominique Pelle)
Solution: Adjust the cursor position right after setting "curwin".
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sat, 18 Mar 2017 23:15:04 +0100 |
parents | eb050472e4b4 |
children | 71311d899b42 |
line wrap: on
line source
" Tests for the +clientserver feature. if !has('job') || !has('clientserver') finish endif source shared.vim let s:where = 0 func Abort(id) call assert_report('Test timed out at ' . s:where) call FinishTesting() endfunc func Test_client_server() let cmd = GetVimCommand() if cmd == '' return endif " Some of these commands may hang when failing. call timer_start(10000, 'Abort') let s:where = 1 let name = 'XVIMTEST' let cmd .= ' --servername ' . name let g:job = job_start(cmd, {'stoponexit': 'kill', 'out_io': 'null'}) call WaitFor('job_status(g:job) == "run"') if job_status(g:job) != 'run' call assert_report('Cannot run the Vim server') return endif let s:where = 2 " Takes a short while for the server to be active. call WaitFor('serverlist() =~ "' . name . '"') call assert_match(name, serverlist()) let s:where = 3 call remote_foreground(name) let s:where = 4 call remote_send(name, ":let testvar = 'yes'\<CR>") let s:where = 5 call WaitFor('remote_expr("' . name . '", "testvar") == "yes"') let s:where = 6 call assert_equal('yes', remote_expr(name, "testvar")) let s:where = 7 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>") let s:where = 8 sleep 500m call remote_send(name, ":let testvar = 'maybe'\<CR>") let s:where = 9 call WaitFor('remote_expr("' . name . '", "testvar") == "maybe"') let s:where = 10 call assert_equal('maybe', remote_expr(name, "testvar")) let s:where = 11 endif call assert_fails('call remote_send("XXX", ":let testvar = ''yes''\<CR>")', 'E241') let s:where = 12 " Expression evaluated locally. if v:servername == '' call remote_startserver('MYSELF') let s:where = 13 call assert_equal('MYSELF', v:servername) endif let g:testvar = 'myself' call assert_equal('myself', remote_expr(v:servername, 'testvar')) let s:where = 14 call remote_send(name, ":call server2client(expand('<client>'), 'got it')\<CR>", 'g:myserverid') let s:where = 15 call assert_equal('got it', remote_read(g:myserverid)) let s:where = 16 call remote_send(name, ":call server2client(expand('<client>'), 'another')\<CR>", 'g:myserverid') let s:where = 151 let peek_result = 'nothing' let r = remote_peek(g:myserverid, 'peek_result') let s:where = 161 " unpredictable whether the result is already avaialble. if r > 0 call assert_equal('another', peek_result) elseif r == 0 call assert_equal('nothing', peek_result) else call assert_report('remote_peek() failed') endif let g:peek_result = 'empty' call WaitFor('remote_peek(g:myserverid, "g:peek_result") > 0') let s:where = 171 call assert_equal('another', g:peek_result) let s:where = 181 call assert_equal('another', remote_read(g:myserverid)) let s:where = 191 call remote_send(name, ":qa!\<CR>") let s:where = 17 call WaitFor('job_status(g:job) == "dead"') let s:where = 18 if job_status(g:job) != 'dead' call assert_report('Server did not exit') call job_stop(g:job, 'kill') endif endfunc " Uncomment this line to get a debugging log " call ch_logfile('channellog', 'w')