Documentation ¶
Index ¶
- func MustRead(path string, vars map[string]string) []byte
- func Read(path string, vars map[string]string) ([]byte, error)
- type Matcher
- func MustMatcher(m *Matcher, err error) *Matcher
- func NewJSONMatcher(data []byte, vars map[string]string) (*Matcher, error)
- func NewJSONMatcherFromFile(path string, vars map[string]string) (*Matcher, error)
- func NewMatcher(data []byte, vars map[string]string, parser matcher.Parser) (*Matcher, error)
- func NewMatcherFromFile(path string, vars map[string]string, parser matcher.Parser) (*Matcher, error)
- type MultipartReader
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Matcher ¶
type Matcher struct {
// contains filtered or unexported fields
}
Matcher implements types.GomegaMatcher
func MustMatcher ¶
MustMatcher can be used with create matcher functions. This panics if the create function returns err != nil.
func NewJSONMatcher ¶
NewJSONMatcher returns a new matcher.
func NewJSONMatcherFromFile ¶
NewJSONMatcherFromFile returns a new matcher.
func NewMatcher ¶
NewMatcher returns a new matcher. vars is used to replace variables in data.
func NewMatcherFromFile ¶
func NewMatcherFromFile(path string, vars map[string]string, parser matcher.Parser) (*Matcher, error)
NewMatcher returns a new matcher. The expected value is read from path. vars is used to replace variables in data.
func (*Matcher) FailureMessage ¶
FailureMessage returns failure message.
func (*Matcher) NegatedFailureMessage ¶
NegatedFailureMessage returns negated failure message.
type MultipartReader ¶
type MultipartReader struct {
// contains filtered or unexported fields
}
MultipartReader represents a read for file containing multiple objects (some as fixtures and some as expected values)
Example:
### key=my_fixture, my fixture { "foo": "bar", "baz": "${{MY_VAR}}", "quux": "${{NOW}}" } # This is a comment. Any line starting with `# ` is a comment and is ignored (note the space after hash). ### key=my_matcher, my awesome matcher { "foo": "bar", "baz": "{{Not(BeEmpty())}}", "quux": "{{BeTimestamp(${{NOW}}, 5000)}}" }
func MustReader ¶
func MustReader(r *MultipartReader, err error) *MultipartReader
MustReader panics if an error occurs.
func NewMultipartReader ¶
func NewMultipartReader(data []byte, vars map[string]string, parser matcher.Parser) (*MultipartReader, error)
NewMultipartReader returns a new reader.
func NewMultipartReaderFromFile ¶
func NewMultipartReaderFromFile(path string, vars map[string]string, parser matcher.Parser) (*MultipartReader, error)
NewMultipartReader returns a new reader.
func (*MultipartReader) GetData ¶
func (r *MultipartReader) GetData(key string) []byte
GetData returns data with variables substituted.
func (*MultipartReader) GetMatcher ¶
func (r *MultipartReader) GetMatcher(key string) (*Matcher, error)
GetData returns *Matcher with variables substituted.
func (*MultipartReader) MustGetMatcher ¶
func (r *MultipartReader) MustGetMatcher(key string) *Matcher
MustGetMatcher panics if an error occurs.
func (*MultipartReader) UpdateVars ¶
func (r *MultipartReader) UpdateVars(vars map[string]string) error
UpdateVars updates r's variable substitution. New matchers must be generated to take effect.