testing

package
v0.0.0-...-1a7b9dc Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2025 License: Apache-2.0, MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FatalIfNil

func FatalIfNil(t *testing.T, err error)

Helper to use 1 line rather than 3-lines block: ```

if err != nil {
    t.Fatal(err)
}

``` in unit test functions.

func RemoveDir

func RemoveDir(t *testing.T, name string)

Removes the directory at the passed path. If deletion fails, `removeDir` terminates the test by calling Fatal.

func TempDir

func TempDir(t *testing.T) string

Creates a temporary directory for the test to use returning its path. Each subsequent call creates a unique directory; if the directory creation fails, `tempDir` terminates the test by calling Fatal.

Similar to https://pkg.go.dev/testing#T.TempDir without the cleanup part. testing#T.TempDir cannot be used as it was introduced in go 1.15.

func WriteFile

func WriteFile(name string, data []byte, perm os.FileMode) error

Same as https://pkg.go.dev/os#WriteFile, os#WriteFile cannot be used as it was introduced in go 1.16.

Types

This section is empty.

Jump to

Keyboard shortcuts

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