github.com/dahs81/otto@v0.2.1-0.20160126165905-6400716cf085/foundation/mock.go (about)

     1  package foundation
     2  
     3  // Mock is a mock implementation of the Foundation interface.
     4  type Mock struct {
     5  	CompileCalled  bool
     6  	CompileContext *Context
     7  	CompileResult  *CompileResult
     8  	CompileErr     error
     9  
    10  	InfraCalled  bool
    11  	InfraContext *Context
    12  	InfraErr     error
    13  }
    14  
    15  func (m *Mock) Compile(ctx *Context) (*CompileResult, error) {
    16  	m.CompileCalled = true
    17  	m.CompileContext = ctx
    18  	return m.CompileResult, m.CompileErr
    19  }
    20  
    21  func (m *Mock) Infra(ctx *Context) error {
    22  	m.InfraCalled = true
    23  	m.InfraContext = ctx
    24  	return m.InfraErr
    25  }