Skip to content

Commit a5bd49b

Browse files
committed
Add null element case to morph unit test
1 parent e923883 commit a5bd49b

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

manifest/morph/morph_test.go

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,32 @@ func TestMorphValueToType(t *testing.T) {
175175
tftypes.NewValue(tftypes.String, "baz"),
176176
}),
177177
},
178+
"tuple(object)->list(object)": {
179+
In: sampleInType{
180+
V: tftypes.NewValue(tftypes.Tuple{ElementTypes: []tftypes.Type{
181+
tftypes.Object{AttributeTypes: map[string]tftypes.Type{"foo": tftypes.String}},
182+
tftypes.Object{AttributeTypes: map[string]tftypes.Type{"foo": tftypes.DynamicPseudoType}},
183+
tftypes.Object{AttributeTypes: map[string]tftypes.Type{"foo": tftypes.String}},
184+
}},
185+
[]tftypes.Value{
186+
tftypes.NewValue(tftypes.Object{AttributeTypes: map[string]tftypes.Type{"foo": tftypes.String}},
187+
map[string]tftypes.Value{"foo": tftypes.NewValue(tftypes.String, "foo")}),
188+
tftypes.NewValue(tftypes.Object{AttributeTypes: map[string]tftypes.Type{"foo": tftypes.DynamicPseudoType}},
189+
map[string]tftypes.Value{"foo": tftypes.NewValue(tftypes.DynamicPseudoType, nil)}),
190+
tftypes.NewValue(tftypes.Object{AttributeTypes: map[string]tftypes.Type{"foo": tftypes.String}},
191+
map[string]tftypes.Value{"foo": tftypes.NewValue(tftypes.String, "baz")}),
192+
}),
193+
T: tftypes.List{ElementType: tftypes.Object{AttributeTypes: map[string]tftypes.Type{"foo": tftypes.String}}},
194+
},
195+
Out: tftypes.NewValue(tftypes.List{ElementType: tftypes.Object{AttributeTypes: map[string]tftypes.Type{"foo": tftypes.String}}}, []tftypes.Value{
196+
tftypes.NewValue(tftypes.Object{AttributeTypes: map[string]tftypes.Type{"foo": tftypes.String}},
197+
map[string]tftypes.Value{"foo": tftypes.NewValue(tftypes.String, "foo")}),
198+
tftypes.NewValue(tftypes.Object{AttributeTypes: map[string]tftypes.Type{"foo": tftypes.String}},
199+
map[string]tftypes.Value{"foo": tftypes.NewValue(tftypes.String, nil)}),
200+
tftypes.NewValue(tftypes.Object{AttributeTypes: map[string]tftypes.Type{"foo": tftypes.String}},
201+
map[string]tftypes.Value{"foo": tftypes.NewValue(tftypes.String, "baz")}),
202+
}),
203+
},
178204
"set->tuple": {
179205
In: sampleInType{
180206
V: tftypes.NewValue(tftypes.Set{ElementType: tftypes.String}, []tftypes.Value{

0 commit comments

Comments
 (0)