formatFailures method

String formatFailures(
  1. List<Failure> failureDetails
)

Method for formatting the test failures' details.

Implementation

String formatFailures(List<Failure> failureDetails) {
  if (failureDetails.isEmpty) {
    return '';
  }

  final StringBuffer sb = StringBuffer();
  int failureCount = 1;
  for (final Failure failure in failureDetails) {
    sb.writeln('Failure in method: ${failure.methodName}');
    sb.writeln(failure.details);
    sb.writeln('end of failure $failureCount\n\n');
    failureCount++;
  }
  return sb.toString();
}