0
0
mirror of https://github.com/vim/vim.git synced 2025-09-30 04:44:14 -04:00

patch 7.4.1336

Problem:    Channel NL mode is not supported yet.
Solution:   Add NL mode support to channels.
This commit is contained in:
Bram Moolenaar
2016-02-16 19:25:12 +01:00
parent 5d54a04598
commit 9a6e33a19b
9 changed files with 151 additions and 34 deletions

View File

@@ -284,7 +284,30 @@ func Test_connect_waittime()
endif
endfunc
func Test_pipe()
func Test_raw_pipe()
if !has('job')
return
endif
let job = job_start(s:python . " test_channel_pipe.py", {'mode': 'raw'})
call assert_equal("run", job_status(job))
try
let handle = job_getchannel(job)
call ch_sendraw(handle, "echo something\n", 0)
let msg = ch_readraw(handle)
call assert_equal("something\n", substitute(msg, "\r", "", 'g'))
call ch_sendraw(handle, "double this\n", 0)
let msg = ch_readraw(handle)
call assert_equal("this\nAND this\n", substitute(msg, "\r", "", 'g'))
let reply = ch_sendraw(handle, "quit\n")
call assert_equal("Goodbye!\n", substitute(reply, "\r", "", 'g'))
finally
call job_stop(job)
endtry
endfunc
func Test_nl_pipe()
if !has('job')
return
endif
@@ -293,9 +316,14 @@ func Test_pipe()
try
let handle = job_getchannel(job)
call ch_sendraw(handle, "echo something\n", 0)
call assert_equal("something\n", ch_readraw(handle))
call assert_equal("something", ch_readraw(handle))
call ch_sendraw(handle, "double this\n", 0)
call assert_equal("this", ch_readraw(handle))
call assert_equal("AND this", ch_readraw(handle))
let reply = ch_sendraw(handle, "quit\n")
call assert_equal("Goodbye!\n", reply)
call assert_equal("Goodbye!", reply)
finally
call job_stop(job)
endtry

View File

@@ -21,4 +21,7 @@ if __name__ == "__main__":
if typed.startswith("echo"):
print(typed[5:-1])
sys.stdout.flush()
if typed.startswith("double"):
print(typed[7:-1] + "\nAND " + typed[7:-1])
sys.stdout.flush()