checker

package
v1.14.9 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DeepEquals check.Checker = &diffChecker{
		&check.CheckerInfo{Name: "Diff", Params: defaultParams},
	}
)

DeepEquals is a GoCheck checker that does a diff between two objects and pretty-prints any difference between the two. It can act as a substitute for DeepEquals.

View Source
var (
	Equals check.Checker = &cmpChecker{
		&check.CheckerInfo{Name: "Equals", Params: cmpParams},
	}
)

Equals is a GoCheck checker that does a diff between two objects and pretty-prints any difference between the two. It can act as a substitute for DeepEquals.

View Source
var ExportedEquals check.Checker = &cmpExportedChecker{&check.CheckerInfo{Name: "ExportedEquals", Params: cmpParams}}

ExportedEquals is a GoCheck checker that does a diff between two objects and pretty-prints any difference between the two. Note that unexported struct fields are NOT included in the comparison! Equals can act as a substitute for DeepEquals with the exception that unexported struct fields are ignored.

View Source
var HasKey check.Checker = &hasKeyChecker{
	&check.CheckerInfo{Name: "HasKey", Params: []string{"map", "key"}},
}

The HasKey checker verifies that the obtained map contains the provided key.

For example:

c.Assert(myMap, HasKey, "five")
View Source
var (
	PartialMatches check.Checker = &matchesChecker{
		&check.CheckerInfo{Name: "PartialMatches", Params: matchesParams},
	}
)

PartialMatches is a GoCheck checker that the provided regex matches at least part of the provided string. It can act as a substitute for Matches.

Functions

func DeepAllowUnexported

func DeepAllowUnexported(vs ...interface{}) cmp.Option

func DeepEqual

func DeepEqual(params ...interface{}) (bool, string)

DeepEqual tests whether two parameters are deeply equal, and returns true if they are. If the objects are not deeply equal, then the second return value includes a json representation of the difference between the parameters.

func DeepIgnoreUnexported

func DeepIgnoreUnexported(vs ...interface{}) cmp.Option

func Equal

func Equal(params ...interface{}) (bool, string)

Equal tests whether two parameters are deeply equal, and returns true if they are. If the objects are not deeply equal, then the second return value includes a json representation of the difference between the parameters.

func ExportedEqual

func ExportedEqual(params ...interface{}) (bool, string)

ExportedEqual tests whether two parameters are deeply equal, when considering only exported fields, and returns true if they are. If the objects are not deeply equal, then the second return value includes a json representation of the difference between the parameters.

Types

This section is empty.

Jump to

Keyboard shortcuts

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