Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -420,10 +420,13 @@ func TestUtils(t *testing.T) {
res = ToString(true)
assert.Equal(t, res, "true")

var arr = []interface{}{1,2,3,"boom"}
res = ToString(int64(10))
assert.Equal(t, res, "10")

var arr = []interface{}{1, 2, 3, int64(4), "boom"}
res = ToString(arr)
assert.Equal(t, res, "[1,2,3,\"boom\"]")
assert.Equal(t, res, "[1,2,3,4,\"boom\"]")

jsonMap := make(map[string]interface{})
jsonMap["object"] = map[string]interface{} {"foo": 1}
res = ToString(jsonMap)
Expand Down
2 changes: 2 additions & 0 deletions utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ func ToString(i interface{}) string {
return strconv.Quote(s)
case int:
return strconv.Itoa(i.(int))
case int64:
return strconv.FormatInt(i.(int64), 10)
case float64:
return strconv.FormatFloat(i.(float64), 'f', -1, 64)
case bool:
Expand Down