2014-10-04 11:00:07 -05:00
|
|
|
package terraform
|
|
|
|
|
2017-10-02 15:19:01 -05:00
|
|
|
import "sync"
|
|
|
|
|
2014-10-04 11:00:07 -05:00
|
|
|
// MockUIOutput is an implementation of UIOutput that can be used for tests.
|
|
|
|
type MockUIOutput struct {
|
2017-10-02 15:19:01 -05:00
|
|
|
sync.Mutex
|
2014-10-10 16:50:35 -05:00
|
|
|
OutputCalled bool
|
|
|
|
OutputMessage string
|
|
|
|
OutputFn func(string)
|
2014-10-04 11:00:07 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
func (o *MockUIOutput) Output(v string) {
|
2017-10-02 15:19:01 -05:00
|
|
|
o.Lock()
|
|
|
|
defer o.Unlock()
|
2014-10-04 11:00:07 -05:00
|
|
|
o.OutputCalled = true
|
2014-10-10 16:50:35 -05:00
|
|
|
o.OutputMessage = v
|
2014-10-04 11:11:51 -05:00
|
|
|
if o.OutputFn != nil {
|
2014-10-04 11:00:07 -05:00
|
|
|
o.OutputFn(v)
|
|
|
|
}
|
|
|
|
}
|