gotesttools

package module
v3.4.0 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2022 License: Apache-2.0 Imports: 0 Imported by: 1

README

gotest.tools

A collection of packages to augment testing and support common patterns.

GoDoc CircleCI Go Reportcard

Usage

With Go modules enabled (go1.11+)

$ go get gotest.tools/v3
import "gotest.tools/v3/assert"

To use gotest.tools with an older version of Go that does not understand Go module paths pin to version v2.3.0.

Packages

  • assert - compare values and fail the test when a comparison fails
  • env - test code which uses environment variables
  • fs - create temporary files and compare a filesystem tree to an expected value
  • golden - compare large multi-line strings against values frozen in golden files
  • icmd - execute binaries and test the output
  • poll - test asynchronous code by polling until a desired state is reached
  • skip - skip a test and print the source code of the condition used to skip the test

Contributing

See CONTRIBUTING.md.

Documentation

Overview

Package gotesttools is a collection of packages to augment `testing` and support common patterns.

Directories

Path Synopsis
Package assert provides assertions for comparing expected values to actual values in tests.
Package assert provides assertions for comparing expected values to actual values in tests.
cmd/gty-migrate-from-testify
Command gty-migrate-from-testify migrates packages from testify/assert and testify/require to gotest.tools/v3/assert.
Command gty-migrate-from-testify migrates packages from testify/assert and testify/require to gotest.tools/v3/assert.
cmp
Package cmp provides Comparisons for Assert and Check
Package cmp provides Comparisons for Assert and Check
opt
Package opt provides common go-cmp.Options for use with assert.DeepEqual.
Package opt provides common go-cmp.Options for use with assert.DeepEqual.
Package env provides functions to test code that read environment variables or the current working directory.
Package env provides functions to test code that read environment variables or the current working directory.
Package fs provides tools for creating temporary files, and testing the contents and structure of a directory.
Package fs provides tools for creating temporary files, and testing the contents and structure of a directory.
Package golden provides tools for comparing large mutli-line strings.
Package golden provides tools for comparing large mutli-line strings.
Package icmd executes binaries and provides convenient assertions for testing the results.
Package icmd executes binaries and provides convenient assertions for testing the results.
internal/stub
Package main produces a test-binary used in tests.
Package main produces a test-binary used in tests.
internal
assert
Package assert provides internal utilties for assertions.
Package assert provides internal utilties for assertions.
cleanup
Package cleanup handles migration to and support for the Go 1.14+ testing.TB.Cleanup() function.
Package cleanup handles migration to and support for the Go 1.14+ testing.TB.Cleanup() function.
difflib
Package difflib is a partial port of Python difflib module.
Package difflib is a partial port of Python difflib module.
format
Package format provides utilities for formatting diffs and messages.
Package format provides utilities for formatting diffs and messages.
maint
Package maint implements assert.TestingT for uses outside of test cases, for example, in a TestMain.
Package maint implements assert.TestingT for uses outside of test cases, for example, in a TestMain.
source
Package source provides utilities for handling source-code.
Package source provides utilities for handling source-code.
Package poll provides tools for testing asynchronous code.
Package poll provides tools for testing asynchronous code.
Package skip provides functions for skipping a test and printing the source code of the condition used to skip the test.
Package skip provides functions for skipping a test and printing the source code of the condition used to skip the test.
x
Package x is a namespace for experimental packages.
Package x is a namespace for experimental packages.
subtest
Package subtest provides a TestContext to subtests which handles cleanup, and provides a testing.TB, and context.Context.
Package subtest provides a TestContext to subtests which handles cleanup, and provides a testing.TB, and context.Context.

Jump to

Keyboard shortcuts

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