github.com/lorbuschris/terraform@v0.11.12-beta1/moduledeps/provider_test.go (about)

     1  package moduledeps
     2  
     3  import (
     4  	"testing"
     5  )
     6  
     7  func TestProviderInstance(t *testing.T) {
     8  	tests := []struct {
     9  		Name      string
    10  		WantType  string
    11  		WantAlias string
    12  	}{
    13  		{
    14  			Name:      "aws",
    15  			WantType:  "aws",
    16  			WantAlias: "",
    17  		},
    18  		{
    19  			Name:      "aws.foo",
    20  			WantType:  "aws",
    21  			WantAlias: "foo",
    22  		},
    23  	}
    24  
    25  	for _, test := range tests {
    26  		t.Run(test.Name, func(t *testing.T) {
    27  			inst := ProviderInstance(test.Name)
    28  			if got, want := inst.Type(), test.WantType; got != want {
    29  				t.Errorf("got type %q; want %q", got, want)
    30  			}
    31  			if got, want := inst.Alias(), test.WantAlias; got != want {
    32  				t.Errorf("got alias %q; want %q", got, want)
    33  			}
    34  		})
    35  	}
    36  }