testutil

package
v0.0.0-...-93548a8 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2020 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Reimport the go-cmp package as the name 'cmp' conflicts with the cmp instruction in the vm.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AllowUnexported

func AllowUnexported(types ...interface{}) cmp.Option

func Diff

func Diff(a, b interface{}, opts ...cmp.Option) string

func FatalIfErr

func FatalIfErr(tb testing.TB, err error)

FatalIfErr fails the test with a fatal error if err is not nil.

func IgnoreUnexported

func IgnoreUnexported(types ...interface{}) cmp.Option

func TestChdir

func TestChdir(tb testing.TB, dir string) func()

TestChdir changes current working directory, and returns a cleanup function to return to the previous directory.

func TestOpenFile

func TestOpenFile(tb testing.TB, name string) *os.File

TestOpenFile creates a new file called name and returns the opened file.

func TestSetFlag

func TestSetFlag(tb testing.TB, name, value string) func()

TestSetFlag sets the value of the commandline flag, and returns a cleanup function that restores the flag value.

func TestTempDir

func TestTempDir(tb testing.TB) (string, func())

TestTempDir creates a temporary directory for use during tests. It returns the pathname, and a cleanup function.

func WriteString

func WriteString(tb testing.TB, f *os.File, str string) int

Types

This section is empty.

Jump to

Keyboard shortcuts

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