agiledragon / agiledragon/gomonkey
mock function affect other tests after Patches.Reset()
Đang mở
- Ngôn ngữ chính
- Go
- Star
- 2.3k
- Fork
- 192
- Merge trung bình
- 1 ngày 6 giờ
- Pull request đã merge (30 ngày)
- 1
Mô tả
func TestA(t *testing.T) {
Convey("TestA", t, func() {
Convey(" test1", func() {
Patches := ApplyFunc(**upgrade**, func(_ int ,_ uint) int{
return 10
})
defer Patches.Reset()
})
}
func **upgrade**(age int, num uint) int {
}
func TestB(t *testing.T){
Cover("TestB",t,func(){
res := **upgrade**(1,1) //it should be return 11 but affect by mock in **TestA**
So(res, ShouldEqual, 11)
})
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Đánh giá
Issue này chưa được đánh giá.