summaryrefslogtreecommitdiffstats
path: root/src/testdir/test_channel.vim
diff options
context:
space:
mode:
authorYegappan Lakshmanan <yegappan@yahoo.com>2022-04-19 10:25:13 +0100
committerBram Moolenaar <Bram@vim.org>2022-04-19 10:25:13 +0100
commitbac9a9e5c233dcf9cf734c61e4e4311fe57eccd1 (patch)
tree6f39b0b5f9405ca4791d568b5c83ee08c5fb7564 /src/testdir/test_channel.vim
parent9bd3ce22e36b5760a5e22e7d34d1bd6a3411258e (diff)
patch 8.2.4788: large payload for LSP message not testedv8.2.4788
Problem: Large payload for LSP message not tested. Solution: Add a test with a large LSP payload. (Yegappan Lakshmanan, closes #10223)
Diffstat (limited to 'src/testdir/test_channel.vim')
-rw-r--r--src/testdir/test_channel.vim12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/testdir/test_channel.vim b/src/testdir/test_channel.vim
index 6fef421e56..e156fa6870 100644
--- a/src/testdir/test_channel.vim
+++ b/src/testdir/test_channel.vim
@@ -2466,7 +2466,7 @@ func LspOtCb(chan, msg)
endfunc
func LspTests(port)
- " call ch_logfile('Xlsprpc.log', 'w')
+ " call ch_logfile('Xlspclient.log', 'w')
let ch = ch_open(s:localhost .. a:port, #{mode: 'lsp', callback: 'LspCb'})
if ch_status(ch) == "fail"
call assert_report("Can't open the lsp channel")
@@ -2620,6 +2620,16 @@ func LspTests(port)
" send a ping to make sure communication still works
call assert_equal('alive', ch_evalexpr(ch, #{method: 'ping'}).result)
+ " Test for a large payload
+ let content = repeat('abcdef', 11000)
+ let resp = ch_evalexpr(ch, #{method: 'large-payload',
+ \ params: #{text: content}})
+ call assert_equal(#{jsonrpc: '2.0', id: 26, result:
+ \ #{method: 'large-payload', jsonrpc: '2.0', id: 26,
+ \ params: #{text: content}}}, resp)
+ " send a ping to make sure communication still works
+ call assert_equal('alive', ch_evalexpr(ch, #{method: 'ping'}).result)
+
" Test for invoking an unsupported method
let resp = ch_evalexpr(ch, #{method: 'xyz', params: {}}, #{timeout: 200})
call assert_equal({}, resp)