github.com/hs0210/hashicorp-terraform@v0.11.12-beta1/terraform/ui_output_mock.go (about)

     1  package terraform
     2  
     3  import "sync"
     4  
     5  // MockUIOutput is an implementation of UIOutput that can be used for tests.
     6  type MockUIOutput struct {
     7  	sync.Mutex
     8  	OutputCalled  bool
     9  	OutputMessage string
    10  	OutputFn      func(string)
    11  }
    12  
    13  func (o *MockUIOutput) Output(v string) {
    14  	o.Lock()
    15  	defer o.Unlock()
    16  	o.OutputCalled = true
    17  	o.OutputMessage = v
    18  	if o.OutputFn != nil {
    19  		o.OutputFn(v)
    20  	}
    21  }