Expect

Runs expectations on a given value. Instances must be created using expect.

Destructor

~this
~this()
Undocumented in source.

Members

Functions

not
ExpectNot!TReceived not()

Negates the expectation.

toApproximatelyEqual
void toApproximatelyEqual(TExpected expected, F maxRelDiff, F maxAbsDiff)

Succeeds if `received.isClose(expected, maxRelDiff, maxAbsDiff)`. Throws a FailingExpectationError otherwise.

toBe
void toBe(TExpected expected)

Succeeds if received is expected. Throws a FailingExpectationError otherwise.

toBeOfType
void toBeOfType()

Succeeds if received is a TExpected or a sub-type of it. Throws a FailingExpectationError if received cannot be cast to TExpected or if received is null.

toContain
void toContain(bool delegate(const(ElementType!TReceived)) predicate)

Succeeds if received contains the expected element or sub-range, or at least one element satisfying the given predicate.

toContain
void toContain(TExpected expected)

Succeeds if received contains the expected element or sub-range, or at least one element satisfying the given predicate.

toContainOnly
void toContainOnly(TExpected expected)
void toContainOnly(bool delegate(const(ElementType!TReceived)) predicate)

Succeeds if all elements in received are equal to expected, or satisfy predicate.

toEqual
void toEqual(TExpected expected)

Succeeds if received == expected. Throws a FailingExpectationError otherwise.

toMatch
void toMatch(TExpected pattern, string flags)

Succeeds if received matches the regular expression pattern. Throws a FailingExpectationError otherwise.

toSatisfy
void toSatisfy(bool delegate(const(TReceived)) predicate)

Succeeds if predicate(received) returns true. Throws a FailingExpectationError otherwise.

toSatisfyAll
void toSatisfyAll(bool delegate(const(TReceived))[] predicates)

Succeeds if predicate(received) returns true for all predicates. Throws a FailingExpectationError otherwise.

toSatisfyAny
void toSatisfyAny(bool delegate(const(TReceived))[] predicates)

Succeeds if predicate(received) returns true for at least one of the given predicates. Throws a FailingExpectationError otherwise.

toThrow
void toThrow()

Calls received and catches any exceptions thrown by it. Succeeds if it catches TExpected or a sub-type. Throws a FailingExpectationError otherwise.

Meta