-
Notifications
You must be signed in to change notification settings - Fork 34
Open
Description
github.com/bytedance/mockey v1.2.14
go 1.24.4
运行命令: go test -gcflags="all=-l -N" -parallel=1
code:
func funcA() int {
return 0
}
// 测试多层嵌套关系下 mock 的影响
func TestMockWithConveyS(t *testing.T) {
mockey.PatchConvey("MockWithConveyS", t, func() {
convey.So(funcA(), convey.ShouldEqual, 0)
mockey.PatchConvey("mock 1", func() {
mockey.Mock(funcA).Return(1).Build()
convey.So(funcA(), convey.ShouldEqual, 1)
mockey.PatchConvey("mock 11", func() {
mockey.Mock(funcA).Return(11).Build()
convey.So(funcA(), convey.ShouldEqual, 11)
})
convey.So(funcA(), convey.ShouldEqual, 1)
})
})
}
10次运行中大概有1~2次运行会报错, 比如:
Expected: 1
Actual: 11
(Should equal)!
其余大多数情况能正常通过测试
Metadata
Metadata
Assignees
Labels
No labels