Mercurial > vim
comparison src/testdir/test_channel.vim @ 8291:ac0c43e7af20 v7.4.1438
commit https://github.com/vim/vim/commit/c7f0ebc6d1e1cdaed816b88a0d6092c5ace615eb
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Feb 27 21:10:09 2016 +0100
patch 7.4.1438
Problem: Can't get buffer number of a channel.
Solution: Add ch_getbufnr().
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sat, 27 Feb 2016 21:15:04 +0100 |
parents | e05e28dcb590 |
children | 5e88bd55b789 |
comparison
equal
deleted
inserted
replaced
8290:285c4ec936b5 | 8291:ac0c43e7af20 |
---|---|
398 finally | 398 finally |
399 call job_stop(job) | 399 call job_stop(job) |
400 endtry | 400 endtry |
401 endfunc | 401 endfunc |
402 | 402 |
403 func Test_pipe_to_nameless_buffer() | |
404 if !has('job') | |
405 return | |
406 endif | |
407 call ch_log('Test_pipe_to_nameless_buffer()') | |
408 let job = job_start(s:python . " test_channel_pipe.py", | |
409 \ {'out-io': 'buffer'}) | |
410 call assert_equal("run", job_status(job)) | |
411 try | |
412 let handle = job_getchannel(job) | |
413 call ch_sendraw(handle, "echo line one\n") | |
414 call ch_sendraw(handle, "echo line two\n") | |
415 exe ch_getbufnr(handle, "out") . 'sbuf' | |
416 for i in range(100) | |
417 sleep 10m | |
418 if line('$') >= 3 | |
419 break | |
420 endif | |
421 endfor | |
422 call assert_equal(['Reading from channel output...', 'line one', 'line two'], getline(1, '$')) | |
423 bwipe! | |
424 finally | |
425 call job_stop(job) | |
426 endtry | |
427 endfunc | |
428 | |
403 """""""""" | 429 """""""""" |
404 | 430 |
405 let s:unletResponse = '' | 431 let s:unletResponse = '' |
406 func s:UnletHandler(handle, msg) | 432 func s:UnletHandler(handle, msg) |
407 let s:unletResponse = a:msg | 433 let s:unletResponse = a:msg |