helper

package
v0.1.34 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2021 License: AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var RepoBaseDir string

RepoBaseDir contains the absolute path to the root of the repository on disk. This is determined by searching up the directory tree until a file called go.mod appears in the current directory.

View Source
var RepoBasePkg string

RepoBasePkg contains the name of the module (eg github.com/myuser/someproj)

Functions

func FromGolden

func FromGolden(name string, val interface{})

FromGolden gob decodes <name>.golden in the caller's directory into val

func Testdata

func Testdata(path string) (io.ReadCloser, error)

Testdata fetches a testdata file. The path should be relative to the /test/testdata directory.

func TestdataFromJSON

func TestdataFromJSON(path string, target interface{})

TestdataFromJSON fetches a testdata file and decodes it into a type. The path should be compatible with Testdata(), and the target should be compatible with Golang's json.Unmarshal().

func TestdataResponder

func TestdataResponder(url, testdata string)

TestdataReponder registers an httpmock responder that responds with the given testdata.

func ToGolden

func ToGolden(name string, val interface{})

ToGolden gob encodes val to a file called <name>.golden in the caller's directory

Types

This section is empty.

Jump to

Keyboard shortcuts

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