Skip to content

Commit

Permalink
Add 'TestInt32ToFrameworkLegacy'.
Browse files Browse the repository at this point in the history
  • Loading branch information
ewbankkit committed Jun 27, 2024
1 parent fd4990a commit b77a755
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions internal/framework/flex/int_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,42 @@ func TestInt32ToFramework(t *testing.T) {
}
}

func TestInt32ToFrameworkLegacy(t *testing.T) {
t.Parallel()

type testCase struct {
input *int32
expected types.Int64
}
tests := map[string]testCase{
"valid int64": {
input: aws.Int32(42),
expected: types.Int64Value(42),
},
"zero int64": {
input: aws.Int32(0),
expected: types.Int64Value(0),
},
"nil int64": {
input: nil,
expected: types.Int64Value(0),
},
}

for name, test := range tests {
name, test := name, test
t.Run(name, func(t *testing.T) {
t.Parallel()

got := flex.Int32ToFrameworkLegacy(context.Background(), test.input)

if diff := cmp.Diff(got, test.expected); diff != "" {
t.Errorf("unexpected diff (+wanted, -got): %s", diff)
}
})
}
}

func TestInt32FromFramework(t *testing.T) {
t.Parallel()

Expand Down

0 comments on commit b77a755

Please sign in to comment.