terraform: UIOutput interface
This commit is contained in:
parent
a5f70ead2d
commit
6445e1f16a
|
@ -0,0 +1,7 @@
|
|||
package terraform
|
||||
|
||||
// UIOutput is the interface that must be implemented to output
|
||||
// data to the end user.
|
||||
type UIOutput interface {
|
||||
Output(string)
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
package terraform
|
||||
|
||||
// MockUIOutput is an implementation of UIOutput that can be used for tests.
|
||||
type MockUIOutput struct {
|
||||
OutputCalled bool
|
||||
OutputMessage string
|
||||
OutputFn func(string)
|
||||
}
|
||||
|
||||
func (o *MockUIOutput) Output(v string) {
|
||||
o.OutputCalled = true
|
||||
o.OutputMessage= v
|
||||
if o.OutputFn == nil {
|
||||
o.OutputFn(v)
|
||||
}
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
package terraform
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestMockUIOutput(t *testing.T) {
|
||||
var _ UIOutput = new(MockUIOutput)
|
||||
}
|
Loading…
Reference in New Issue