@@ -24,6 +24,7 @@ func TestUnmarshalBasic(t *testing.T) {
2424 AttrIntWithFloat types.Int64 `tfsdk:"attr_int_with_float"`
2525 AttrTrue types.Bool `tfsdk:"attr_true"`
2626 AttrFalse types.Bool `tfsdk:"attr_false"`
27+ AttrMANYUpper types.Int64 `tfsdk:"attr_many_upper"`
2728 }
2829 const (
2930 // attribute_not_in_model is ignored because it is not in the model, no error is thrown.
@@ -39,7 +40,8 @@ func TestUnmarshalBasic(t *testing.T) {
3940 "attrFloatWithInt": 13,
4041 "attrNotInModel": "val",
4142 "attrNull": null,
42- "attrJSON": {"hello": "there"}
43+ "attrJSON": {"hello": "there"},
44+ "attrMANYUpper": 1
4345 }
4446 `
4547 )
@@ -52,6 +54,7 @@ func TestUnmarshalBasic(t *testing.T) {
5254 assert .InEpsilon (t , float64 (456.1 ), model .AttrFloat .ValueFloat64 (), epsilon )
5355 assert .InEpsilon (t , float64 (13 ), model .AttrFloatWithInt .ValueFloat64 (), epsilon )
5456 assert .True (t , model .AttrNotInJSON .IsNull ()) // attributes not in JSON response are not changed, so null is kept.
57+ assert .Equal (t , int64 (1 ), model .AttrMANYUpper .ValueInt64 ())
5558 assert .JSONEq (t , "{\" hello\" :\" there\" }" , model .AttrJSON .ValueString ())
5659}
5760
@@ -62,11 +65,12 @@ func TestUnmarshalNestedAllTypes(t *testing.T) {
6265 type modelEmptyTest struct {}
6366
6467 type modelCustomTypeTest struct {
65- AttrFloat types.Float64 `tfsdk:"attr_float"`
66- AttrString types.String `tfsdk:"attr_string"`
67- AttrNested customtype.ObjectValue [modelEmptyTest ] `tfsdk:"attr_nested"`
68- AttrInt types.Int64 `tfsdk:"attr_int"`
69- AttrBool types.Bool `tfsdk:"attr_bool"`
68+ AttrFloat types.Float64 `tfsdk:"attr_float"`
69+ AttrString types.String `tfsdk:"attr_string"`
70+ AttrNested customtype.ObjectValue [modelEmptyTest ] `tfsdk:"attr_nested"`
71+ AttrInt types.Int64 `tfsdk:"attr_int"`
72+ AttrBool types.Bool `tfsdk:"attr_bool"`
73+ AttrMANYUpper types.Int64 `tfsdk:"attr_many_upper"`
7074 }
7175
7276 type modelst struct {
@@ -109,11 +113,12 @@ func TestUnmarshalNestedAllTypes(t *testing.T) {
109113 AttrObjParent : types .ObjectNull (objTypeParentTest .AttrTypes ),
110114 AttrCustomObj : customtype .NewObjectValue [modelCustomTypeTest ](ctx , modelCustomTypeTest {
111115 // these attribute values are irrelevant, they will be overwritten with JSON values
112- AttrString : types .StringValue ("different_string" ),
113- AttrInt : types .Int64Value (999 ),
114- AttrFloat : types .Float64Unknown (), // can even be unknown
115- AttrBool : types .BoolUnknown (), // can even be unknown
116- AttrNested : customtype.NewObjectValueUnknown [modelEmptyTest ](ctx ),
116+ AttrString : types .StringValue ("different_string" ),
117+ AttrInt : types .Int64Value (999 ),
118+ AttrFloat : types .Float64Unknown (), // can even be unknown
119+ AttrBool : types .BoolUnknown (), // can even be unknown
120+ AttrNested : customtype.NewObjectValueUnknown [modelEmptyTest ](ctx ),
121+ AttrMANYUpper : types .Int64Value (999 ),
117122 }),
118123 AttrCustomObjNullNotSent : customtype.NewObjectValueNull [modelCustomTypeTest ](ctx ),
119124 AttrCustomObjNullSent : customtype.NewObjectValueNull [modelCustomTypeTest ](ctx ),
@@ -172,7 +177,8 @@ func TestUnmarshalNestedAllTypes(t *testing.T) {
172177 "attrInt": 123,
173178 "attrFloat": 1.1,
174179 "attrBool": true,
175- "attrNested": {}
180+ "attrNested": {},
181+ "attrMANYUpper": 456
176182 },
177183 "attrCustomObjNullSent": {
178184 "attrString": "null_obj",
@@ -325,34 +331,38 @@ func TestUnmarshalNestedAllTypes(t *testing.T) {
325331 }),
326332 }),
327333 AttrCustomObj : customtype .NewObjectValue [modelCustomTypeTest ](ctx , modelCustomTypeTest {
328- AttrString : types .StringValue ("value_string" ),
329- AttrInt : types .Int64Value (123 ),
330- AttrFloat : types .Float64Value (1.1 ),
331- AttrBool : types .BoolValue (true ),
332- AttrNested : customtype .NewObjectValue [modelEmptyTest ](ctx , modelEmptyTest {}),
334+ AttrString : types .StringValue ("value_string" ),
335+ AttrInt : types .Int64Value (123 ),
336+ AttrFloat : types .Float64Value (1.1 ),
337+ AttrBool : types .BoolValue (true ),
338+ AttrNested : customtype .NewObjectValue [modelEmptyTest ](ctx , modelEmptyTest {}),
339+ AttrMANYUpper : types .Int64Value (456 ),
333340 }),
334341 AttrCustomObjNullNotSent : customtype.NewObjectValueNull [modelCustomTypeTest ](ctx ),
335342 AttrCustomObjNullSent : customtype .NewObjectValue [modelCustomTypeTest ](ctx , modelCustomTypeTest {
336- AttrString : types .StringValue ("null_obj" ),
337- AttrInt : types .Int64Value (1 ),
338- AttrFloat : types .Float64Null (),
339- AttrBool : types .BoolNull (),
340- AttrNested : customtype.NewObjectValueNull [modelEmptyTest ](ctx ),
343+ AttrString : types .StringValue ("null_obj" ),
344+ AttrInt : types .Int64Value (1 ),
345+ AttrFloat : types .Float64Null (),
346+ AttrBool : types .BoolNull (),
347+ AttrNested : customtype.NewObjectValueNull [modelEmptyTest ](ctx ),
348+ AttrMANYUpper : types .Int64Null (),
341349 }),
342350 AttrCustomObjUnknownNotSent : customtype.NewObjectValueUnknown [modelCustomTypeTest ](ctx ),
343351 AttrCustomObjUnknownSent : customtype .NewObjectValue [modelCustomTypeTest ](ctx , modelCustomTypeTest {
344- AttrString : types .StringValue ("unknown_obj" ),
345- AttrInt : types .Int64Null (),
346- AttrFloat : types .Float64Null (),
347- AttrBool : types .BoolNull (),
348- AttrNested : customtype.NewObjectValueNull [modelEmptyTest ](ctx ),
352+ AttrString : types .StringValue ("unknown_obj" ),
353+ AttrInt : types .Int64Null (),
354+ AttrFloat : types .Float64Null (),
355+ AttrBool : types .BoolNull (),
356+ AttrNested : customtype.NewObjectValueNull [modelEmptyTest ](ctx ),
357+ AttrMANYUpper : types .Int64Null (),
349358 }),
350359 AttrCustomObjParent : customtype .NewObjectValue [modelCustomTypeTest ](ctx , modelCustomTypeTest {
351- AttrString : types .StringValue ("parent string" ),
352- AttrInt : types .Int64Null (),
353- AttrFloat : types .Float64Null (),
354- AttrBool : types .BoolNull (),
355- AttrNested : customtype .NewObjectValue [modelEmptyTest ](ctx , modelEmptyTest {}),
360+ AttrString : types .StringValue ("parent string" ),
361+ AttrInt : types .Int64Null (),
362+ AttrFloat : types .Float64Null (),
363+ AttrBool : types .BoolNull (),
364+ AttrNested : customtype .NewObjectValue [modelEmptyTest ](ctx , modelEmptyTest {}),
365+ AttrMANYUpper : types .Int64Null (),
356366 }),
357367 AttrListString : types .ListValueMust (types .StringType , []attr.Value {
358368 types .StringValue ("list1" ),
0 commit comments