# Functions
And succeeds only if all of the given matchers succeed.
BeADirectory succeeds if a file exists and is a directory.
BeAnExistingFile succeeds if a file exists.
BeARegularFile succeeds if a file exists and is a regular file.
BeAssignableToTypeOf succeeds if actual is assignable to the type of expected.
BeClosed succeeds if actual is a closed channel.
BeComparableTo uses gocmp.Equal from github.com/google/go-cmp (instead of reflect.DeepEqual) to perform a deep comparison.
BeElementOf succeeds if actual is contained in the passed in elements.
BeEmpty succeeds if actual is empty.
BeEquivalentTo is more lax than Equal, allowing equality between different types.
BeFalse succeeds if actual is false
In general, it's better to use `BeFalseBecause(reason)` to provide a more useful error message if a false check fails.
BeFalseBecause succeeds if actual is false and displays the provided reason if it is true.
BeIdenticalTo uses the == operator to compare actual with expected.
BeKeyOf succeeds if actual is contained in the keys of the passed in map.
BeNil succeeds if actual is nil.
BeNumerically performs numerical assertions in a type-agnostic way.
BeSent succeeds if a value can be sent to actual.
BeTemporally compares time.Time's like BeNumerically Actual and expected must be time.Time.
BeTrue succeeds if actual is true
In general, it's better to use `BeTrueBecause(reason)` to provide a more useful error message if a true check fails.
BeTrueBecause succeeds if actual is true and displays the provided reason if it is false fmt.Sprintf is used to render the reason.
BeZero succeeds if actual is the zero value for its type or if actual is nil.
ConsistOf succeeds if actual contains precisely the elements passed into the matcher.
ContainElement succeeds if actual contains the passed in element.
ContainElements succeeds if actual contains the passed in elements.
ContainSubstring succeeds if actual is a string or stringer that contains the passed-in substring.
Equal uses reflect.DeepEqual to compare actual with expected.
HaveCap succeeds if actual has the passed-in capacity.
HaveEach succeeds if actual solely contains elements that match the passed in element.
HaveExactElements succeeds if actual contains elements that precisely match the elemets passed into the matcher.
HaveExistingField succeeds if actual is a struct and the specified field exists.
HaveField succeeds if actual is a struct and the value at the passed in field matches the passed in matcher.
HaveHTTPBody matches if the body matches.
HaveHTTPHeaderWithValue succeeds if the header is found and the value matches.
HaveHTTPStatus succeeds if the Status or StatusCode field of an HTTP response matches.
HaveKey succeeds if actual is a map with the passed in key.
HaveKeyWithValue succeeds if actual is a map with the passed in key and value.
HaveLen succeeds if actual has the passed-in length.
HaveOccurred succeeds if actual is a non-nil error The typical Go error checking pattern looks like:
err := SomethingThatMightFail() Expect(err).ShouldNot(HaveOccurred()).
HavePrefix succeeds if actual is a string or stringer that contains the passed-in string as a prefix.
HaveSuffix succeeds if actual is a string or stringer that contains the passed-in string as a suffix.
HaveValue applies the given matcher to the value of actual, optionally and repeatedly dereferencing pointers or taking the concrete value of interfaces.
Implement checks if the object implements the interface.
MatchError succeeds if actual is a non-nil error that matches the passed in string, error, function, or matcher.
MatchJSON succeeds if actual is a string or stringer of JSON that matches the expected JSON.
MatchRegexp succeeds if actual is a string or stringer that matches the passed-in regexp.
MatchXML succeeds if actual is a string or stringer of XML that matches the expected XML.
MatchYAML succeeds if actual is a string or stringer of YAML that matches the expected YAML.
No description provided by the author
Not negates the given matcher; it succeeds if the given matcher fails.
Or succeeds if any of the given matchers succeed.
Panic succeeds if actual is a function that, when invoked, panics.
PanicWith succeeds if actual is a function that, when invoked, panics with a specific value.
Receive succeeds if there is a value to be received on actual.
Satisfy matches the actual value against the `predicate` function.
SatisfyAll is an alias for And().
SatisfyAny is an alias for Or().
Succeed passes if actual is a nil error Succeed is intended to be used with functions that return a single error value.
WithTransform applies the `transform` to the actual value and matches it against `matcher`.