servertest

package
v0.15.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 8, 2023 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Overview

Package servertest provides utilities for running tests against a remote LSP server.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Connector

type Connector interface {
	Connect(context.Context) jsonrpc2.Conn
}

Connector is the interface used to connect to a server.

type PipeServer

type PipeServer struct {
	// contains filtered or unexported fields
}

PipeServer is a test server that handles connections over io.Pipes.

func NewPipeServer

func NewPipeServer(server jsonrpc2.StreamServer, framer jsonrpc2.Framer) *PipeServer

NewPipeServer returns a test server that can be connected to via io.Pipes.

func (PipeServer) Close

func (l PipeServer) Close() error

func (*PipeServer) Connect

func (s *PipeServer) Connect(ctx context.Context) jsonrpc2.Conn

Connect creates new io.Pipes and binds them to the underlying StreamServer.

type TCPServer

type TCPServer struct {
	Addr string
	// contains filtered or unexported fields
}

TCPServer is a helper for executing tests against a remote jsonrpc2 connection. Once initialized, its Addr field may be used to connect a jsonrpc2 client.

func NewTCPServer

func NewTCPServer(ctx context.Context, server jsonrpc2.StreamServer, framer jsonrpc2.Framer) *TCPServer

NewTCPServer returns a new test server listening on local tcp port and serving incoming jsonrpc2 streams using the provided stream server. It panics on any error.

func (TCPServer) Close

func (l TCPServer) Close() error

func (*TCPServer) Connect

func (s *TCPServer) Connect(_ context.Context) jsonrpc2.Conn

Connect dials the test server and returns a jsonrpc2 Connection that is ready for use.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL