Skip to content

Commit b77a755

Browse files
committed
Add 'TestInt32ToFrameworkLegacy'.
1 parent fd4990a commit b77a755

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

internal/framework/flex/int_test.go

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,42 @@ func TestInt32ToFramework(t *testing.T) {
161161
}
162162
}
163163

164+
func TestInt32ToFrameworkLegacy(t *testing.T) {
165+
t.Parallel()
166+
167+
type testCase struct {
168+
input *int32
169+
expected types.Int64
170+
}
171+
tests := map[string]testCase{
172+
"valid int64": {
173+
input: aws.Int32(42),
174+
expected: types.Int64Value(42),
175+
},
176+
"zero int64": {
177+
input: aws.Int32(0),
178+
expected: types.Int64Value(0),
179+
},
180+
"nil int64": {
181+
input: nil,
182+
expected: types.Int64Value(0),
183+
},
184+
}
185+
186+
for name, test := range tests {
187+
name, test := name, test
188+
t.Run(name, func(t *testing.T) {
189+
t.Parallel()
190+
191+
got := flex.Int32ToFrameworkLegacy(context.Background(), test.input)
192+
193+
if diff := cmp.Diff(got, test.expected); diff != "" {
194+
t.Errorf("unexpected diff (+wanted, -got): %s", diff)
195+
}
196+
})
197+
}
198+
}
199+
164200
func TestInt32FromFramework(t *testing.T) {
165201
t.Parallel()
166202

0 commit comments

Comments
 (0)