github.com/cmd-stream/base-go@v0.0.0-20230813145615-dd6ac24c16f5/testdata/mock/Result.go (about)

     1  package mock
     2  
     3  import (
     4  	"github.com/ymz-ncnk/mok"
     5  )
     6  
     7  func NewResult() Result {
     8  	return Result{
     9  		Mock: mok.New("Result"),
    10  	}
    11  }
    12  
    13  type Result struct {
    14  	*mok.Mock
    15  }
    16  
    17  func (m Result) RegisterLastOne(fn func() (lastOne bool)) Result {
    18  	m.Register("LastOne", fn)
    19  	return m
    20  }
    21  
    22  func (m Result) LastOne() (lastOne bool) {
    23  	vals, err := m.Call("LastOne")
    24  	if err != nil {
    25  		panic(err)
    26  	}
    27  	lastOne = vals[0].(bool)
    28  	return
    29  }