context library

Classes

CheckFailure
The result an expectation that failed for a subject..
Context<T>
The context for a Subject that allows asserting expectations and creating nested subjects.
Extracted<T>
A property extracted from a value being checked, or a rejection.
FailureDetail
The context for a failed expectation.
Rejection
A description of a value that failed an expectation.
Subject<T>
A target for checking expectations against a value in a test.

Extensions

ContextExtension on Subject<T>

Functions

describe<T>(Condition<T> condition) Iterable<String>
Creates a description of the expectations checked by condition.
describeAsync<T>(AsyncCondition<T> condition) Future<Iterable<String>>
Creates a description of the expectations checked by condition.
escape(String output) String
Returns output with all whitespace characters represented as their escape sequences.
indent(Iterable<String> lines, [int depth = 1]) Iterable<String>
literal(Object? object) Iterable<String>
Returns a pretty-printed representation of object.
postfixLast(String postfix, Iterable<String> lines) Iterable<String>
Append postfix to the last line of lines.
prefixFirst(String prefix, Iterable<String> lines) Iterable<String>
Prepends prefix to the first line of lines.
softCheck<T>(T value, Condition<T> condition) CheckFailure?
Checks whether value satisfies all expectations invoked in condition, without throwing an exception.
softCheckAsync<T>(T value, AsyncCondition<T> condition) Future<CheckFailure?>
Checks whether value satisfies all expectations invoked in condition, without throwing an exception.

Typedefs

AsyncCondition<T> = FutureOr<void> Function(Subject<T>)
A callback that asynchronously checks expectations against a subject.
Condition<T> = void Function(Subject<T>)
A callback that synchronously checks expectations against a subject.