fstest

package
v5.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2024 License: GPL-2.0 Imports: 4 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

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

func ReadFile

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 WriteExecutable

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

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

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