Open acgcc12 opened 4 years ago
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) })
Can your code run?
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) })