I'm trying to test one of my package to reach 100%. However, I can't find how I can do this without being "against the system" (functions pointers, etc.).
I tried to do something similar to this, but I can't reach 100% because of "real" functions :
var fs fileSystem = osFS{}
type fileSystem interface {
Open(name string) (file, error)
Stat(name string) (os.FileInfo, error)
}
type file interface {
io.Closer
io.Reader
io.ReaderAt
io.Seeker
Stat() (os.FileInfo, error)
}
// osFS implements fileSystem using the local disk.
type osFS struct{}
func (osFS) Open(name string) (file, error) { return os.Open(name) }
func (osFS) Stat(name string) (os.FileInfo, error) { return os.Stat(name) }
(From https://talks.golang.org/2012/10things.slide#8)
Does someone would have a suggestion ? :) Thanks !