Documentation
¶
Index ¶
- func IsStar(obj oj.OJsonObject) bool
- type DefaultFileResolver
- func (fr *DefaultFileResolver) ReplacePath(pathInTest, actualPath string) *DefaultFileResolver
- func (fr *DefaultFileResolver) ResolveAbsolutePath(value string) string
- func (fr *DefaultFileResolver) ResolveFileValue(value string) ([]byte, error)
- func (fr *DefaultFileResolver) SetContext(contextPath string)
- type FileResolver
- type Parser
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsStar ¶
func IsStar(obj oj.OJsonObject) bool
Types ¶
type DefaultFileResolver ¶
type DefaultFileResolver struct {
// contains filtered or unexported fields
}
DefaultFileResolver loads file contents for the test parser.
func NewDefaultFileResolver ¶
func NewDefaultFileResolver() *DefaultFileResolver
NewDefaultFileResolver yields a new DefaultFileResolver instance.
func (*DefaultFileResolver) ReplacePath ¶
func (fr *DefaultFileResolver) ReplacePath(pathInTest, actualPath string) *DefaultFileResolver
ReplacePath offers the possibility to swap a path with another withouot providing a new set of tests. It is very useful when testing multiple contracts against the same tests.
func (*DefaultFileResolver) ResolveAbsolutePath ¶
func (fr *DefaultFileResolver) ResolveAbsolutePath(value string) string
ResolveAbsolutePath yields absolute value based on context.
func (*DefaultFileResolver) ResolveFileValue ¶
func (fr *DefaultFileResolver) ResolveFileValue(value string) ([]byte, error)
ResolveFileValue converts a value prefixed with "file:" and replaces it with the file contents.
func (*DefaultFileResolver) SetContext ¶
func (fr *DefaultFileResolver) SetContext(contextPath string)
SetContext sets directory where the test runs, to help resolve relative paths.
type FileResolver ¶
type FileResolver interface { // SetContext sets directory where the test runs, to help resolve relative paths. SetContext(contextPath string) // ResolveAbsolutePath yields absolute value based on context. ResolveAbsolutePath(value string) string // ResolveFileValue converts a value prefixed with "file:" and replaces it with the file contents. ResolveFileValue(value string) ([]byte, error) }
FileResolver resolves values starting with "file:"
type Parser ¶
type Parser struct {
FileResolver FileResolver
}
Parser performs parsing of both json tests (older) and scenarios (new).
func (*Parser) ParseScenarioFile ¶
ParseScenarioFile converts a scenario json string to scenario object representation
func (*Parser) ParseScenarioStep ¶
ParseScenarioStep parses a single scenario step, instead of an entire file. Handy for tests, where step snippets can be embedded in code.