Slide 20
Slide 20 text
6. 依存のモッキング
type kvsStub struct {
set func(k string, v interface{})
get func(k string) (v interface{}, ok bool)
}
func (s *kvsStub) Set(k string, v interface{}) {
if s.set == nil {
panic("set field is nil")
}
s.set(k, v)
}
// Get も同様
関数フィールドを
使ったスタブ