From 91ca47b2ea3d1d3b6c598b8892fda1542b0ad17e Mon Sep 17 00:00:00 2001 From: Nathan <148575555+nathan-artie@users.noreply.github.com> Date: Wed, 26 Jun 2024 15:15:23 -0700 Subject: [PATCH] Add more tests --- lib/maputil/map_test.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/lib/maputil/map_test.go b/lib/maputil/map_test.go index 7d4c3d55b..7b700d40a 100644 --- a/lib/maputil/map_test.go +++ b/lib/maputil/map_test.go @@ -1,6 +1,7 @@ package maputil import ( + "math" "reflect" "testing" @@ -35,6 +36,8 @@ func TestGetInt32FromMap(t *testing.T) { "ghi": "hello", "123": "-321", "123 (number)": -321, + "maxInt32": math.MaxInt32, + "int64": math.MaxInt32 + 1, } testCases := []struct { @@ -86,6 +89,18 @@ func TestGetInt32FromMap(t *testing.T) { key: "123 (number)", expectedValue: -321, }, + { + name: "max int32", + obj: object, + key: "maxInt32", + expectedValue: int32(math.MaxInt32), + }, + { + name: "int64", + obj: object, + key: "int64", + expectedErr: "value out of range", + }, } for _, testCase := range testCases {