代码拉取完成,页面将自动刷新
package graphql
import (
"math"
"testing"
"github.com/stretchr/testify/assert"
)
func TestMarshalID(t *testing.T) {
tests := []struct {
Name string
Input interface{}
Expected string
ShouldError bool
}{
{
Name: "int64",
Input: int64(12),
Expected: "12",
ShouldError: false,
},
{
Name: "int64 max",
Input: math.MaxInt64,
Expected: "9223372036854775807",
},
{
Name: "int64 min",
Input: math.MinInt64,
Expected: "-9223372036854775808",
},
}
for _, tt := range tests {
t.Run(tt.Name, func(t *testing.T) {
id, err := UnmarshalID(tt.Input)
assert.Equal(t, tt.Expected, id)
if tt.ShouldError {
assert.Error(t, err)
} else {
assert.NoError(t, err)
}
})
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。