Closed ElvisWai closed 1 month ago
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.
:white_check_mark: ElvisWai
:x: liziwei
Describe the bug
使用 assert 的 NotNil 断言时不生效
Replay 测试代码:
import "github.com/cloudwego/hertz/pkg/common/test/assert"
func TestAssertNotNil(t *testing.T) {
var test interface{}
assert.NotNil(t, test)
fmt.Println("test 值不为空")
}
Hertz version:
version: 0.9.2
bugfix
func NotNil(t testing.TB, data interface{}) {
t.Helper()
if data != nil {
return
}
if reflect.ValueOf(data).IsNil() {
t.Fatalf("assertion failed, unexpected: %v, expected: not nil", data)
}
}
有一些 ut 没过,可以瞅瞅
@welkeyever 🐶 这是原本的 ut 写错了 Nil 和 NotNil 原本期望是达到什么效果?
@welkeyever 🐶 这是原本的 ut 写错了 Nil 和 NotNil 原本期望是达到什么效果?
嗯,看起来是的,可以一并修复下对应的 ut
@welkeyever 有问题的ut改完了,但提交的账号不一致。。。这能解决吗
可能需要统一下,可以本地 squash 成一个 commit
我重新提交PR
1178
修复 assert的 NotNil 不生效。(参数判断有误)