agiledragon / agiledragon/gomonkey
ApplyPrivateMethod return interface is invalid in 1.16
- Langage dominant
- Go
- Étoiles
- 2.3k
- Forks
- 192
- Merge moyen
- 1 j 6 h
- PR mergées (30 j)
- 1
Description
PrivateMethodStruct add two private methods:
```
func (this *PrivateMethodStruct) lastError() error{
return nil
}
func (this *PrivateMethodStruct) LastError() error{
return this.lastError()
}
```
TestApplyPrivateMethod add test below:
```
Convey("patch private method return interface", func() {
f := new(fake.PrivateMethodStruct)
var s *fake.PrivateMethodStruct
pErr := errors.New("error")
patches := ApplyPrivateMethod(s, "lastError", func() error {
return pErr
})
defer patches.Reset()
result := f.LastError()
So(result, ShouldEqual, pErr)
})
```
we got a panic: invalid memory address or nil pointer dereference
Guide de contribution
Aucun guide de contribution indexé pour ce dépôt
Évaluation
Cette issue n'a pas encore été évaluée.