Open LugeKit opened 2 years ago
Version: v1.7.2 ApplyFunc use github.com/agiledragon/gomonkey/v2 v2.1.0
v1.7.2
github.com/agiledragon/gomonkey/v2 v2.1.0
Code:
func Test(t *testing.T) { Convey("Test", t, func() { defer ApplyFunc(json.Marshal, func(v interface{}) ([]byte, error) { return nil, errors.New("test shouldNotEqual") }).Reset() _, err := json.Marshal("") So(err, ShouldNotEqual, nil) }) }
Result:
Failures: Line 97: Expected 'test shouldNotEqual' to NOT equal '<nil>' (but it did)! 1 total assertion --- FAIL: Test (0.00s) FAIL
Version:
v1.7.2
ApplyFunc usegithub.com/agiledragon/gomonkey/v2 v2.1.0
Code:
Result: