utils

package
v0.0.0-...-5874d13 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TestClientServer

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

TestClientServer is a simple abstraction meant to be used as an io.ReadWriter with seabird.Bot so messages can be tracked.

func NewTestClientServer

func NewTestClientServer() *TestClientServer

NewTestClientServer returns a new TestClientServer.

func (*TestClientServer) CheckLines

func (cs *TestClientServer) CheckLines(t *testing.T, expected []string) bool

CheckLines will ensure that the client sent all the expected lines (and nothing more) and return true if they did and false if they didn't.

func (*TestClientServer) Read

func (cs *TestClientServer) Read(p []byte) (int, error)

Read is what will be coming from the "server".

func (*TestClientServer) Reset

func (cs *TestClientServer) Reset()

Reset clears the contents of the internal buffers.

func (*TestClientServer) SendServerLines

func (cs *TestClientServer) SendServerLines(lines []string)

SendServerLines will send all given irc.Messages as if they were coming from the server, to be read by the test client.

func (*TestClientServer) Write

func (cs *TestClientServer) Write(p []byte) (int, error)

Write is what will be going to the "server".

type TestHandler

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

TestHandler is meant to be inserted as a Handler somewhere to capture all messages which are sent.

func (*TestHandler) Handle

func (th *TestHandler) Handle(ctx context.Context, m *irc.Message)

Handle implements the Handler interface.

func (*TestHandler) PopMessages

func (th *TestHandler) PopMessages() []*irc.Message

PopMessages will return all the messages that were passed to this handler.

Jump to

Keyboard shortcuts

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