fail

package
v0.0.0-...-c936f35 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package fail provides methods to test and verify failing assertions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssertFails

func AssertFails(t *testing.T, fn func(*testing.T), formatAndArgs ...interface{})

AssertFails asserts that the given test function fails the test.

func Failed

func Failed(fn func(*testing.T)) bool

Failed returns true if the given function failed the test.

Types

type TestSetup

type TestSetup struct {
	// contains filtered or unexported fields
}

TestSetup represents an already set up test environment, which provides a variant on AssertFails that fails the test as normal, but also fails the test if the setup function causes test failures.

func Setup

func Setup(setupFn func(*testing.T)) *TestSetup

Setup shares the fake testing.T instance between a setup method and a test method, providing an AssertFails method that fails the test if the setup fails, or if the test method does not.

func (*TestSetup) AssertFails

func (s *TestSetup) AssertFails(t *testing.T, fn func(*testing.T), formatAndArgs ...interface{})

AssertFails asserts that the given test function fails the test, and that the setup function used did not cause any test failures.

Jump to

Keyboard shortcuts

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