fstest

package
v3.4.2 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2024 License: GPL-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package fstest provides test utilties to operate with files and directories

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Chmod

func Chmod(t *testing.T, name string, mode os.FileMode)

Chmod is wrappoer of os.Chmod that fails the test if chmod returns an error.

func MkdirAll added in v3.4.0

func MkdirAll(t *testing.T, path string)

func ReadFile added in v3.4.1

func ReadFile(t *testing.T, path string) []byte

ReadFile reads the file at path and returns its content.

func Symlink(t *testing.T, oldname, newname string)

func TempDir

func TempDir(t *testing.T) string

TempDir returns a path, with all symlinks in it resolved, to a unique temporary directory. The directory is removed via t.Cleanup() on termination of the test. (On MacOS t.TempDir() returns a symlink.)

func WriteToFile

func WriteToFile(t *testing.T, data []byte, path string)

WriteToFile writes data to a file. Directories that are in the path but do not exist are created. If an error happens, t.Fatal() is called.

Types

This section is empty.

Jump to

Keyboard shortcuts

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