Skip to content
This repository has been archived by the owner on Aug 29, 2022. It is now read-only.

Commit

Permalink
Add Manager.WithStarter and Manager.WithCloser
Browse files Browse the repository at this point in the history
  • Loading branch information
nhatthm committed Apr 19, 2021
1 parent 6a05bb7 commit cf68c92
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,20 @@ func (m *Manager) isConsoleOutput(expected *godog.DocString) error {
return t.LastError()
}

// WithStarter adds a Starter to Manager.
func (m *Manager) WithStarter(s Starter) *Manager {
m.starters = append(m.starters, s)

return m
}

// WithCloser adds a Closer to Manager.
func (m *Manager) WithCloser(c Closer) *Manager {
m.closers = append(m.closers, c)

return m
}

// New initiates a new console Manager.
func New(t *testing.T, options ...Option) *Manager { // nolint: thelper
m := &Manager{
Expand All @@ -120,13 +134,13 @@ func New(t *testing.T, options ...Option) *Manager { // nolint: thelper
// WithStarter adds a Starter to Manager.
func WithStarter(s Starter) Option {
return func(m *Manager) {
m.starters = append(m.starters, s)
m.WithStarter(s)
}
}

// WithCloser adds a Closer to Manager.
func WithCloser(c Closer) Option {
return func(m *Manager) {
m.closers = append(m.closers, c)
m.WithCloser(c)
}
}

0 comments on commit cf68c92

Please sign in to comment.