test

package
v2.26.0 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// TmpDirPattern is the pattern used for tmp folder creation
	TmpDirPattern = "tmp-reva-"
)

Variables

This section is empty.

Functions

func DirEquals

func DirEquals(dir1, dir2 string) bool

DirEquals recursively verifies that the content of two dir is the same. Two files are equals if the name and the content is equal, while two folders are equal if the name is equal and the content is recursively equal.

func NewFile

func NewFile(path, content string) error

NewFile creates a new file given the path and the content

Types

type CleanerFunc

type CleanerFunc func()

CleanerFunc is a function to call after creating a TestDir

func NewTestDir

func NewTestDir(src Dir) (tmpdir string, cleanup CleanerFunc, err error)

NewTestDir creates the Dir structure in a local temporary folder

func TmpDir

func TmpDir() (string, CleanerFunc, error)

TmpDir creates a dir in the system temp folder that has TmpDirPattern as prefix

type Dir

type Dir map[string]interface{}

Dir struct represents a test dir, where each key is the resource (Dir or File) name

type File

type File struct {
	Content string
}

File struct represents a test file, with a certain content. Its name is defined in TestDir

Jump to

Keyboard shortcuts

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