Skip to content

Commit 85fbb38

Browse files
committed
Add 'TestInt32FromFrameworkLegacy'.
1 parent b77a755 commit 85fbb38

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

internal/framework/flex/int_test.go

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,3 +236,43 @@ func TestInt32FromFramework(t *testing.T) {
236236
})
237237
}
238238
}
239+
240+
func TestInt32FromFrameworkLegacy(t *testing.T) {
241+
t.Parallel()
242+
243+
type testCase struct {
244+
input types.Int64
245+
expected *int32
246+
}
247+
tests := map[string]testCase{
248+
"valid int64": {
249+
input: types.Int64Value(42),
250+
expected: aws.Int32(42),
251+
},
252+
"zero int64": {
253+
input: types.Int64Value(0),
254+
expected: nil,
255+
},
256+
"null int64": {
257+
input: types.Int64Null(),
258+
expected: nil,
259+
},
260+
"unknown int64": {
261+
input: types.Int64Unknown(),
262+
expected: nil,
263+
},
264+
}
265+
266+
for name, test := range tests {
267+
name, test := name, test
268+
t.Run(name, func(t *testing.T) {
269+
t.Parallel()
270+
271+
got := flex.Int32FromFrameworkLegacy(context.Background(), test.input)
272+
273+
if diff := cmp.Diff(got, test.expected); diff != "" {
274+
t.Errorf("unexpected diff (+wanted, -got): %s", diff)
275+
}
276+
})
277+
}
278+
}

0 commit comments

Comments
 (0)