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