terraform: UIOutput interface

This commit is contained in:
Mitchell Hashimoto 2014-10-04 09:00:07 -07:00
parent a5f70ead2d
commit 6445e1f16a
3 changed files with 32 additions and 0 deletions

7
terraform/ui_output.go Normal file
View File

@ -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)
}

View File

@ -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)
}
}

View File

@ -0,0 +1,9 @@
package terraform
import (
"testing"
)
func TestMockUIOutput(t *testing.T) {
var _ UIOutput = new(MockUIOutput)
}