Documentation ¶
Overview ¶
Package module provides a test module that can be used in tests.
Index ¶
- type TestModule
- func (t *TestModule) AssertClicked(args ...interface{}) bar.Event
- func (t *TestModule) AssertNotClicked(args ...interface{})
- func (t *TestModule) AssertNotStarted(args ...interface{})
- func (t *TestModule) AssertStarted(args ...interface{})
- func (t *TestModule) Close()
- func (t *TestModule) Output(out bar.Output)
- func (t *TestModule) OutputText(text string)
- func (t *TestModule) SkipClickHandlers() *TestModule
- func (t *TestModule) Stream(sink bar.Sink)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type TestModule ¶
TestModule represents a bar.Module used for testing.
func New ¶
func New(t require.TestingT) *TestModule
New creates a new module with the given testingT that can be used to assert the behaviour of the bar (or related modules).
func (*TestModule) AssertClicked ¶
func (t *TestModule) AssertClicked(args ...interface{}) bar.Event
AssertClicked asserts that the module was clicked and returns the event. Calling this multiple times asserts multiple click events.
func (*TestModule) AssertNotClicked ¶
func (t *TestModule) AssertNotClicked(args ...interface{})
AssertNotClicked asserts that the module received no events.
func (*TestModule) AssertNotStarted ¶
func (t *TestModule) AssertNotStarted(args ...interface{})
AssertNotStarted asserts that the module was not started.
func (*TestModule) AssertStarted ¶
func (t *TestModule) AssertStarted(args ...interface{})
AssertStarted waits for the module to start, or does nothing if the module is already streaming.
func (*TestModule) Close ¶
func (t *TestModule) Close()
Close closes the module's channels, allowing the bar to restart the module on click.
func (*TestModule) Output ¶
func (t *TestModule) Output(out bar.Output)
Output queues output to be sent over the channel on the next read.
func (*TestModule) OutputText ¶
func (t *TestModule) OutputText(text string)
OutputText is shorthand for Output(bar.TextSegment(...)).
func (*TestModule) SkipClickHandlers ¶
func (t *TestModule) SkipClickHandlers() *TestModule
SkipClickHandlers configures the module to skip adding a default click handler on output. Setting this will break AssertClicked, but can be useful when comparing the output of this module in tests.
func (*TestModule) Stream ¶
func (t *TestModule) Stream(sink bar.Sink)
Stream conforms to bar.Module.