diff options
author | Bram Moolenaar <Bram@vim.org> | 2016-02-16 19:25:12 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2016-02-16 19:25:12 +0100 |
commit | 9a6e33a19b18f20c25b73392cd2faa3ec4890c8c (patch) | |
tree | 2c13d3d751e1e635c4ca4fa8dbc854598a669f89 /src/testdir | |
parent | 5d54a045989599468b7a971fc354b0cba4e2b09d (diff) |
patch 7.4.1336v7.4.1336
Problem: Channel NL mode is not supported yet.
Solution: Add NL mode support to channels.
Diffstat (limited to 'src/testdir')
-rw-r--r-- | src/testdir/test_channel.vim | 34 | ||||
-rw-r--r-- | src/testdir/test_channel_pipe.py | 3 |
2 files changed, 34 insertions, 3 deletions
diff --git a/src/testdir/test_channel.vim b/src/testdir/test_channel.vim index 62b5c89b42..e9c2a98e70 100644 --- a/src/testdir/test_channel.vim +++ b/src/testdir/test_channel.vim @@ -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 diff --git a/src/testdir/test_channel_pipe.py b/src/testdir/test_channel_pipe.py index 495fa80124..5994d27ffd 100644 --- a/src/testdir/test_channel_pipe.py +++ b/src/testdir/test_channel_pipe.py @@ -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() |