testos

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2021 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Overview

Package testos provides utilities for common OS assert/require test operations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssertExists

func AssertExists(t *testing.T, osa osaPkg.I, path string) bool

AssertExists asserts that a file or directory exists.

func AssertExistsIsDir

func AssertExistsIsDir(t *testing.T, osa osaPkg.I, path string, wantDir bool) bool

AssertExistsIsDir asserts that an entry exists and is either file or directory.

func AssertFileData

func AssertFileData(t *testing.T, osa osaPkg.I, path string, want string) bool

AssertFileData requires that a file exists and has a certain data

func AssertIsEmpty

func AssertIsEmpty(t *testing.T, osa osaPkg.I, path string) bool

AssertIsEmpty asserts that a file or directory is empty.

func AssertNotExists

func AssertNotExists(t *testing.T, osa osaPkg.I, path string) bool

AssertNotExists asserts that a file or directory does not exist.

func AssertStdWrite

func AssertStdWrite(
	t *testing.T,
	stdWrite io.Writer,
	stdRead io.Reader,
	message string,
) bool

AssertStdWrite tests a writable standard stream (i.e. Stdout or Stderr).

func Join

func Join(elem ...string) string

Join joins any number of path elements into a single path.

func RequireEmptyWrite

func RequireEmptyWrite(t *testing.T, osa osaPkg.I, path string)

RequireEmptyWrite requires that writing an empty file succeeds.

func RequireExists

func RequireExists(t *testing.T, osa osaPkg.I, path string)

RequireExists requires that a file or directory exists.

func RequireExistsIsDir

func RequireExistsIsDir(t *testing.T, osa osaPkg.I, path string, wantDir bool)

RequireExistsIsDir requires that an entry exists and is either file or directory.

func RequireFileData

func RequireFileData(t *testing.T, osa osaPkg.I, path string, want string)

RequireFileData requires that a file exists and has a certain data

func RequireIsEmpty

func RequireIsEmpty(t *testing.T, osa osaPkg.I, path string)

RequireIsEmpty requires that a file or directory is empty.

func RequireMkdir

func RequireMkdir(t *testing.T, osa osaPkg.I, path string)

RequireMkdir requires that creating a directory succeeds.

func RequireMkdirAll

func RequireMkdirAll(t *testing.T, osa osaPkg.I, path string)

RequireMkdirAll requires that creating a directory (and possible parent directories) succeeds.

func RequireNotExists

func RequireNotExists(t *testing.T, osa osaPkg.I, path string)

RequireNotExists requires that a file or directory does not exist.

func RequireTempDir added in v0.1.1

func RequireTempDir(t *testing.T, osa osaPkg.I) string

RequireTempDir requires that a temp dir was created.

func RequireWrite

func RequireWrite(t *testing.T, osa osaPkg.I, path string, data string)

RequireWrite requires that writing to a file succeeds.

Types

This section is empty.

Jump to

Keyboard shortcuts

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