Back to godoc.org

Package testfs

v0.0.0-...-d4769a7
Latest Go to latest

The latest major version is .

Published: Aug 1, 2020 | License: Apache-2.0 | Module: github.com/luci/luci-go

Index

func Build

func Build(base string, layout map[string]string) error

Build constructs a filesystem hierarchy given a layout.

The layouts keys should be ToSlash-style file paths. Its values should be the content that is written at those paths. Intermediate directories will be automatically created.

To create a directory, end its path with a "/". In this case, the content will be ignored.

func Collect

func Collect(base string) (map[string]string, error)

Collect constructs layout from a given directory.

This function does reverse of Build. Content of empty directory is represented as "" with "/" suffix. But this does not work if there are symlink entries under |base| dir.

func MustWithTempDir

func MustWithTempDir(t *testing.T, prefix string, fn func(string)) func()

MustWithTempDir calls WithTempDir and panics if any failures occur.

func WithTempDir

func WithTempDir(t *testing.T, prefix string, fn func(string) error) error

WithTempDir creates a temporary directory and passes it to fn. After fn exits, the directory is cleaned up.

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier