describe<T> function

Iterable<String> describe<T>(
  1. Condition<T> condition
)

Creates a description of the expectations checked by condition.

The strings are individual lines of a description. The description of an expectation may be one or more adjacent lines.

Matches the "Expected: " lines in the output of a failure message if a value did not meet the last expectation in condition, without the first labeled line.

Asynchronous expectations are not allowed in condition, for async conditions use describeAsync.

Implementation

Iterable<String> describe<T>(Condition<T> condition) {
  final context = _TestContext<T>._root(
    value: _Absent(),
    fail: (_) {
      throw UnimplementedError();
    },
    allowAsync: false,
    allowUnawaited: true,
  );
  condition(Subject._(context));
  return context.detail(context).expected.skip(1);
}