function TTextTestListener.PrintFailures(r :TTestResult): string;
var
i :integer;
failure :TTestFailure;
begin
result := '';
if (r.failureCount <> 0) then begin
if (r.failureCount = 1) then
result := result + format('There was %d failure:', [r.failureCount]) + CRLF
else
result := result + format('There were %d failures:', [r.failureCount]) + CRLF;
for i := 0 to r.failures.Count-1 do begin
failure := TObject(r.failures[i]) as TTestFailure;
result := result + format('%d) %s: %s: %s', [
i+1,
failure.failedTest.name,
failure.thrownExceptionName,
failure.thrownExceptionMessage
]) + CRLF;
end;
result := result + CRLF
end
End; |