Documentation ¶
Index ¶
- Variables
- func AfterTests(recorder *Recorder, recorderVar string)
- func BeforeTests(recorder *Recorder)
- func Decode(data interface{}, target interface{}) interface{}
- func Run(m *testing.M)
- type GenOptions
- type Generator
- type Recorder
- func (r *Recorder) EnableRecording(enable bool)
- func (r *Recorder) Load(name string, recordings []Recording)
- func (r *Recorder) Record(t *testing.T, key interface{}, value interface{}) interface{}
- func (r *Recorder) RecordNext(t *testing.T, value interface{}) interface{}
- func (r *Recorder) RecordingEnabled() bool
- func (r *Recorder) Reset()
- type Recording
Constants ¶
This section is empty.
Variables ¶
var Must = must
export Must util method, so we can use it with some methods like json.Unmarshal
var Ptr = valToPtr
export Ptr util method to get pointer of a value using reflection
var R = NewRecorder()
R defines a global test recorder
var Record = R.Record
var RecordNext = R.RecordNext
Functions ¶
func AfterTests ¶
AfterTests is method to use in TestMain after running tests
func BeforeTests ¶
func BeforeTests(recorder *Recorder)
BeforeTests is method to use in TestMain before running tests
Types ¶
type GenOptions ¶
type Generator ¶
type Generator struct {
// contains filtered or unexported fields
}
Generator generates golang code
func NewGenerator ¶
func (*Generator) GenerateToFile ¶
func (g *Generator) GenerateToFile(recorder *Recorder, opts GenOptions, filePath string) error
type Recorder ¶
type Recorder struct {
// contains filtered or unexported fields
}
func (*Recorder) EnableRecording ¶
EnableRecording enables test recording
func (*Recorder) Record ¶
Recorder method records value under specified key. If recording is enabled Record returns provided value, otherwise it returns already recorded value.
func (*Recorder) RecordNext ¶
RecordNext method records next value in sequence. If recording is enabled Record returns provided value, otherwise it returns alreday recorded value.
func (*Recorder) RecordingEnabled ¶
RecordingEnabled returns whether recording is enabled