kubeform.dev/terraform-backend-sdk@v0.0.0-20220310143633-45f07fe731c5/terraform/ui_input_prefix_test.go (about)

     1  package terraform
     2  
     3  import (
     4  	"context"
     5  	"testing"
     6  )
     7  
     8  func TestPrefixUIInput_impl(t *testing.T) {
     9  	var _ UIInput = new(PrefixUIInput)
    10  }
    11  
    12  func TestPrefixUIInput(t *testing.T) {
    13  	input := new(MockUIInput)
    14  	prefix := &PrefixUIInput{
    15  		IdPrefix: "foo",
    16  		UIInput:  input,
    17  	}
    18  
    19  	_, err := prefix.Input(context.Background(), &InputOpts{Id: "bar"})
    20  	if err != nil {
    21  		t.Fatalf("err: %s", err)
    22  	}
    23  
    24  	if input.InputOpts.Id != "foo.bar" {
    25  		t.Fatalf("bad: %#v", input.InputOpts)
    26  	}
    27  }