opentofu/terraform/resource_test.go
2014-06-30 20:59:23 -07:00

32 lines
449 B
Go

package terraform
import (
"reflect"
"testing"
)
func TestResource_Vars(t *testing.T) {
r := new(Resource)
if len(r.Vars()) > 0 {
t.Fatalf("bad: %#v", r.Vars())
}
r = &Resource{
Id: "key",
State: &ResourceState{
Attributes: map[string]string{
"foo": "bar",
},
},
}
expected := map[string]string{
"key.foo": "bar",
}
actual := r.Vars()
if !reflect.DeepEqual(actual, expected) {
t.Fatalf("bad: %#v", actual)
}
}