github.com/terramate-io/tf@v0.0.0-20230830114523-fce866b4dfcd/legacy/terraform/ui_input_prefix_test.go (about)

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