agiledragon / agiledragon/gomonkey
mock function affect other tests after Patches.Reset()
Ouverte
- Langage dominant
- Go
- Étoiles
- 2.3k
- Forks
- 192
- Merge moyen
- 1 j 6 h
- PR mergées (30 j)
- 1
Description
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)
})
Guide de contribution
Aucun guide de contribution indexé pour ce dépôt
Évaluation
Cette issue n'a pas encore été évaluée.