assert

package
v0.7.3 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2018 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package assert contains functions for making assertions in unit tests From github.com/docker/docker/pkg/testutil/assert

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Contains

func Contains(t TestingT, actual, contains string)

Contains asserts that the string contains a substring, otherwise it fails the test.

func DeepEqual

func DeepEqual(t TestingT, actual, expected interface{})

DeepEqual compare the actual value to the expected value and fails the test if they are not "deeply equal".

func Equal

func Equal(t TestingT, actual, expected interface{}, msg string)

Equal compare the actual value to the expected value and fails the test if they are not equal.

func EqualStringSlice

func EqualStringSlice(t TestingT, actual, expected []string)

EqualStringSlice compares two slices and fails the test if they do not contain the same items.

func Error

func Error(t TestingT, err error, contains string)

Error asserts that error is not nil, and contains the expected text, otherwise it fails the test.

func False

func False(t TestingT, obj bool)

False fails the test if the object is true

func Less

func Less(t TestingT, x, y interface{})

func Must

func Must(b bool)

func MustNoError

func MustNoError(err error)

func Nil

func Nil(t TestingT, obj interface{})

Nil fails the test if the object is not nil

func NilError

func NilError(t TestingT, err error)

NilError asserts that the error is nil, otherwise it fails the test.

func NotEqual

func NotEqual(t TestingT, actual, expected interface{}, msg string)

NotEqual compare the actual value to the expected value and fails the test if they are equal.

func NotNil

func NotNil(t TestingT, obj interface{})

NotNil fails the test if the object is nil

func True

func True(t TestingT, obj bool)

True fails the test if the object is false

Types

type T

type T struct{}

func (*T) Fatalf

func (t *T) Fatalf(format string, a ...interface{})

type TestingT

type TestingT interface {
	Fatalf(string, ...interface{})
}

TestingT is an interface which defines the methods of testing.T that are required by this package

Jump to

Keyboard shortcuts

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