robin/laufey
git clone https://git.robinwobin.dev/robin/laufey
9432e6c1e2
master
1--- RPC server fixture. 2-- 3-- Lua's paths are passed as arguments to reflect the path in the test itself. 4package . path =arg [ 1 ] 5package . cpath =arg [ 2 ] 6 7local StdioStream =require 'test.client.uv_stream' . StdioStream 8local Session =require 'test.client.session' 9 10local stdio_stream =StdioStream . open () 11local session =Session . new ( stdio_stream ) 12 13local function on_request ( method , args ) 14if method == 'poll' then 15return 'ok' 16elseif method == 'write_stderr' then 17io . stderr : write ( args [ 1 ]) 18return 'done!' 19elseif method == 'exit' then 20session : stop () 21return vim . NIL 22end 23end 24 25local function on_notification ( event , args ) 26if event == 'ping' and # args == 0 then 27session : notify ( 'nvim_eval' , "rpcnotify(g:channel, 'pong')" ) 28end 29end 30 31session : run ( on_request , on_notification ) 32session : close ()