From 5cf46b7a1b452b921cfaf7f49cfaea6d65d74027 Mon Sep 17 00:00:00 2001 From: vincents Date: Mon, 18 Aug 2008 22:25:13 +0000 Subject: [PATCH] fpcunit console testrunner: flush output of progress writer after each character, so that the result is written immediately, even if the output is redirected to file git-svn-id: trunk@16128 - --- components/fpcunit/console/consoletestrunner.pas | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/components/fpcunit/console/consoletestrunner.pas b/components/fpcunit/console/consoletestrunner.pas index d72f6bfdf8..33f7a5e4df 100644 --- a/components/fpcunit/console/consoletestrunner.pas +++ b/components/fpcunit/console/consoletestrunner.pas @@ -76,6 +76,7 @@ type TProgressWriter= class(TNoRefCountObject, ITestListener) private FSuccess: boolean; + procedure WriteChar(c: char); public destructor Destroy; override; @@ -88,6 +89,13 @@ type procedure EndTestSuite(ATestSuite: TTestSuite); end; +procedure TProgressWriter.WriteChar(c: char); +begin + write(c); + // flush output, so that we see the char immediately, even it is written to file + Flush(output); +end; + destructor TProgressWriter.Destroy; begin // on descruction, just write the missing line ending @@ -98,13 +106,13 @@ end; procedure TProgressWriter.AddFailure(ATest: TTest; AFailure: TTestFailure); begin FSuccess := false; - write('F'); + writechar('F'); end; procedure TProgressWriter.AddError(ATest: TTest; AError: TTestFailure); begin FSuccess := false; - write('E'); + writechar('E'); end; procedure TProgressWriter.StartTest(ATest: TTest); @@ -115,7 +123,7 @@ end; procedure TProgressWriter.EndTest(ATest: TTest); begin if FSuccess then - write('.'); + writechar('.'); end; procedure TProgressWriter.StartTestSuite(ATestSuite: TTestSuite);