patch 8.2.4788: large payload for LSP message not tested
Problem: Large payload for LSP message not tested.
Solution: Add a test with a large LSP payload. (Yegappan Lakshmanan,
closes #10223)
diff --git a/src/testdir/test_channel.vim b/src/testdir/test_channel.vim
index 6fef421..e156fa6 100644
--- a/src/testdir/test_channel.vim
+++ b/src/testdir/test_channel.vim
@@ -2466,7 +2466,7 @@
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 @@
" 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)