diff --git a/internal/framework/flex/int_test.go b/internal/framework/flex/int_test.go index 8f700842499..6d19a021d9a 100644 --- a/internal/framework/flex/int_test.go +++ b/internal/framework/flex/int_test.go @@ -236,3 +236,43 @@ func TestInt32FromFramework(t *testing.T) { }) } } + +func TestInt32FromFrameworkLegacy(t *testing.T) { + t.Parallel() + + type testCase struct { + input types.Int64 + expected *int32 + } + tests := map[string]testCase{ + "valid int64": { + input: types.Int64Value(42), + expected: aws.Int32(42), + }, + "zero int64": { + input: types.Int64Value(0), + expected: nil, + }, + "null int64": { + input: types.Int64Null(), + expected: nil, + }, + "unknown int64": { + input: types.Int64Unknown(), + expected: nil, + }, + } + + for name, test := range tests { + name, test := name, test + t.Run(name, func(t *testing.T) { + t.Parallel() + + got := flex.Int32FromFrameworkLegacy(context.Background(), test.input) + + if diff := cmp.Diff(got, test.expected); diff != "" { + t.Errorf("unexpected diff (+wanted, -got): %s", diff) + } + }) + } +}