mandosfileresolver

package
v1.3.0-rel Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 12, 2021 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

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) Clone

func (fr *DefaultFileResolver) Clone() FileResolver

Clone creates new instance of the same type.

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 {
	// Clone creates new instance of the same type.
	Clone() FileResolver

	// 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 Mandos values starting with "file:"

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL