opentofu/internal/plugin/ui_output_test.go

39 lines
751 B
Go
Raw Normal View History

// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0
package plugin
2014-10-04 11:11:51 -05:00
import (
"testing"
"github.com/hashicorp/go-plugin"
"github.com/placeholderplaceholderplaceholder/opentf/internal/opentf"
2014-10-04 11:11:51 -05:00
)
func TestUIOutput_impl(t *testing.T) {
var _ opentf.UIOutput = new(UIOutput)
2014-10-04 11:11:51 -05:00
}
func TestUIOutput_input(t *testing.T) {
client, server := plugin.TestRPCConn(t)
2014-10-04 11:11:51 -05:00
defer client.Close()
o := new(opentf.MockUIOutput)
2014-10-04 11:11:51 -05:00
err := server.RegisterName("Plugin", &UIOutputServer{
2014-10-04 11:11:51 -05:00
UIOutput: o,
})
if err != nil {
t.Fatalf("err: %s", err)
}
output := &UIOutput{Client: client}
2014-10-04 11:11:51 -05:00
output.Output("foo")
if !o.OutputCalled {
t.Fatal("output should be called")
}
if o.OutputMessage != "foo" {
t.Fatalf("bad: %#v", o.OutputMessage)
}
}