Skip to content

Commit

Permalink
Add 'TestInt32FromFrameworkLegacy'.
Browse files Browse the repository at this point in the history
  • Loading branch information
ewbankkit committed Jun 27, 2024
1 parent b77a755 commit 85fbb38
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions internal/framework/flex/int_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
})
}
}

0 comments on commit 85fbb38

Please sign in to comment.