comparison src/testdir/test_channel.vim @ 28511:d7ca583e5772 v8.2.4780

patch 8.2.4780: parsing an LSP message fails when it is split Commit: https://github.com/vim/vim/commit/03cca297df5210f94be2246cfdb1ee9a30454bea Author: Yegappan Lakshmanan <yegappan@yahoo.com> Date: Mon Apr 18 14:07:46 2022 +0100 patch 8.2.4780: parsing an LSP message fails when it is split Problem: Parsing an LSP message fails when it is split. Solution: Collapse the received data before parsing. (Yegappan Lakshmanan, closes #10215)
author Bram Moolenaar <Bram@vim.org>
date Mon, 18 Apr 2022 15:15:04 +0200
parents 3beb14b12bbd
children 6b1da12297e5
comparison
equal deleted inserted replaced
28510:3f4bd5516667 28511:d7ca583e5772
2578 " Test for processing the extra fields in the HTTP header 2578 " Test for processing the extra fields in the HTTP header
2579 let resp = ch_evalexpr(ch, #{method: 'extra-hdr-fields', params: {}}) 2579 let resp = ch_evalexpr(ch, #{method: 'extra-hdr-fields', params: {}})
2580 call assert_equal({'id': 14, 'jsonrpc': '2.0', 'result': 'extra-hdr-fields'}, 2580 call assert_equal({'id': 14, 'jsonrpc': '2.0', 'result': 'extra-hdr-fields'},
2581 \ resp) 2581 \ resp)
2582 2582
2583 " Test for processing delayed payload
2584 let resp = ch_evalexpr(ch, #{method: 'delayed-payload', params: {}})
2585 call assert_equal({'id': 15, 'jsonrpc': '2.0', 'result': 'delayed-payload'},
2586 \ resp)
2587
2583 " Test for processing a HTTP header without the Content-Length field 2588 " Test for processing a HTTP header without the Content-Length field
2584 let resp = ch_evalexpr(ch, #{method: 'hdr-without-len', params: {}}, 2589 let resp = ch_evalexpr(ch, #{method: 'hdr-without-len', params: {}},
2585 \ #{timeout: 200}) 2590 \ #{timeout: 200})
2586 call assert_equal({}, resp) 2591 call assert_equal({}, resp)
2587 " send a ping to make sure communication still works 2592 " send a ping to make sure communication still works
2627 " Send a ping to wait for all the notification messages to arrive 2632 " Send a ping to wait for all the notification messages to arrive
2628 call assert_equal('alive', ch_evalexpr(ch, #{method: 'ping'}).result) 2633 call assert_equal('alive', ch_evalexpr(ch, #{method: 'ping'}).result)
2629 call assert_equal([], g:lspNotif) 2634 call assert_equal([], g:lspNotif)
2630 " Restore the callback function 2635 " Restore the callback function
2631 call ch_setoptions(ch, #{callback: 'LspCb'}) 2636 call ch_setoptions(ch, #{callback: 'LspCb'})
2632 let g:lspNotif = []
2633 call ch_sendexpr(ch, #{method: 'echo', params: #{s: 'no-callback'}})
2634 " Send a ping to wait for all the notification messages to arrive
2635 call assert_equal('alive', ch_evalexpr(ch, #{method: 'ping'}).result)
2636 call assert_equal([#{jsonrpc: '2.0', result:
2637 \ #{method: 'echo', jsonrpc: '2.0', params: #{s: 'no-callback'}}}],
2638 \ g:lspNotif)
2639 2637
2640 " " Test for sending a raw message 2638 " " Test for sending a raw message
2641 " let g:lspNotif = [] 2639 " let g:lspNotif = []
2642 " let s = "Content-Length: 62\r\n" 2640 " let s = "Content-Length: 62\r\n"
2643 " let s ..= "Content-Type: application/vim-jsonrpc; charset=utf-8\r\n" 2641 " let s ..= "Content-Type: application/vim-jsonrpc; charset=utf-8\r\n"