mapstest

package
v4.1.9 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const Strict strictMarker = 0

Strict is an option that can be passed to the Contains and Equivalent assertions. It disables the default ContainsOptions.

Variables

This section is empty.

Functions

func AssertContains

func AssertContains(t TestingT, v1, v2 interface{}, optsMsgAndArgs ...interface{}) bool

AssertContains returns true if maps.Contains(v1, v2). The following ContainsOptions are automatically applied:

- maps.EmptyMapValuesMatchAny - maps.IgnoreTimeZones(true) - maps.ParseTimes

These default options can be suppressed by passing Strict in the options:

AssertContains(t, v1, v2, Strict)

optsMsgAndArgs can contain a string msg and a series of args, which will be formatted into the assertion failure message.

optsMsgAndArgs may also contain additional ContainOptions, which will be extracted and applied to the Contains() function.

func AssertEquivalent

func AssertEquivalent(t TestingT, v1, v2 interface{}, optsMsgAndArgs ...interface{}) bool

AssertEquivalent returns true if maps.Equivalent(v1, v2). The following ContainsOptions are automatically applied:

- maps.EmptyMapValuesMatchAny - maps.IgnoreTimeZones(true) - maps.ParseTimes

optsMsgAndArgs can contain a string msg and a series of args, which will be formatted into the assertion failure message.

optsMsgAndArgs may also contain additional ContainOptions, which will be extracted and applied to the Equivalent() function.

func AssertNotContains

func AssertNotContains(t TestingT, v1, v2 interface{}, optsMsgAndArgs ...interface{}) bool

AssertNotContains is the inverse of AssertContains

func AssertNotEquivalent

func AssertNotEquivalent(t TestingT, v1, v2 interface{}, optsMsgAndArgs ...interface{}) bool

AssertNotEquivalent is the inverse of AssertEquivalent

func RequireContains

func RequireContains(t TestingT, v1, v2 interface{}, optsMsgAndArgs ...interface{})

RequireContains is like AssertContains, but fails the test immediately.

func RequireEquivalent

func RequireEquivalent(t TestingT, v1, v2 interface{}, optsMsgAndArgs ...interface{})

RequireEquivalent is like AssertEquivalent, but fails the test immediately.

func RequireNotContains

func RequireNotContains(t TestingT, v1, v2 interface{}, optsMsgAndArgs ...interface{})

RequireNotContains is like AssertNotContains, but fails the test immediately.

func RequireNotEquivalent

func RequireNotEquivalent(t TestingT, v1, v2 interface{}, optsMsgAndArgs ...interface{})

RequireNotEquivalent is like AssertNotEquivalent, but fails the test immediately.

Types

type TestingT

type TestingT = require.TestingT

TestingT is a subset of testing.TB

Jump to

Keyboard shortcuts

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