Răsfoiți Sursa

+ Patch from Graeme to add DUnit compatibility interface.

git-svn-id: trunk@3968 -
michael 19 ani în urmă
părinte
comite
fce57deb31

+ 1 - 0
.gitattributes

@@ -766,6 +766,7 @@ fcl/dbtests/testbasics.pas svneol=native#text/plain
 fcl/dbtests/testdbbasics.pas -text
 fcl/dbtests/testsqlfieldtypes.pas -text
 fcl/dbtests/toolsunit.pas -text
+fcl/fpcunit/DUnitCompatibleInterface.inc svneol=native#text/plain
 fcl/fpcunit/Makefile svneol=native#text/plain
 fcl/fpcunit/Makefile.fpc svneol=native#text/plain
 fcl/fpcunit/README.txt svneol=native#text/plain

+ 138 - 0
fcl/fpcunit/DUnitCompatibleInterface.inc

@@ -0,0 +1,138 @@
+{%MainUnit fpcunit.pp}
+
+{$IFDEF read_interface}
+
+{
+    function  GetName: string; virtual;
+    property  Name: string read GetName;
+}
+
+    class procedure Check(pValue: boolean; pMessage: string = '');
+    class procedure CheckEquals(expected, actual: extended; msg: string = ''); overload;
+    class procedure CheckEquals(expected, actual: string; msg: string = ''); overload;
+    class procedure CheckEquals(expected, actual: extended; delta: extended; msg: string = ''); overload;
+    class procedure CheckEquals(expected, actual: integer; msg: string = ''); overload;
+    class procedure CheckEquals(expected, actual: boolean; msg: string = ''); overload;
+    class procedure CheckEquals(expected, actual: TClass; msg: string = ''); overload;
+    class procedure CheckNotEquals(expected, actual: string; msg: string = ''); overload;
+    class procedure CheckNull(obj: IUnknown; msg: string = ''); overload;
+    class procedure CheckNull(obj: TObject; msg: string = ''); overload;
+    class procedure CheckNotNull(obj: TObject; msg: string = ''); overload;
+    class procedure CheckIs(obj :TObject; pClass: TClass; msg: string = ''); overload;
+    class procedure CheckSame(expected, actual: TObject; msg: string = ''); overload;
+    {
+    *** TODO  ***
+    procedure CheckEqualsBin(expected, actual: longword; msg: string = ''; digits: integer=32); virtual;
+    procedure CheckEqualsHex(expected, actual: longword; msg: string = ''; digits: integer=8); virtual;
+
+    procedure CheckNotEquals(expected, actual: integer; msg: string = ''); overload; virtual;
+    procedure CheckNotEquals(expected: extended; actual: extended; delta: extended = 0; msg: string = ''); overload; virtual;
+    procedure CheckNotEquals(expected, actual: boolean; msg: string = ''); overload; virtual;
+    procedure CheckNotEqualsBin(expected, actual: longword; msg: string = ''; digits: integer=32); virtual;
+    procedure CheckNotEqualsHex(expected, actual: longword; msg: string = ''; digits: integer=8); virtual;
+
+    procedure CheckNotNull(obj :IUnknown; msg :string = ''); overload; virtual;
+    procedure CheckSame(expected, actual: IUnknown; msg: string = ''); overload; virtual;
+
+
+    procedure CheckException(AMethod: TTestMethod; AExceptionClass: TClass; msg :string = '');
+    procedure CheckInherits(expected, actual: TClass; msg: string = ''); overload; virtual;
+    }
+
+{$ENDIF read_interface}
+
+
+{$IFDEF read_implementation}
+
+{
+function TAssert.GetName: string;
+begin
+  Result := TestName;
+end;
+}
+
+class procedure TAssert.Check(pValue: boolean; pMessage: string);
+begin
+  AssertTrue(pMessage, pValue);
+end;
+
+
+class procedure TAssert.CheckEquals(expected, actual: extended; msg: string);
+begin
+  AssertEquals(msg, expected, actual);
+end;
+
+
+class procedure TAssert.CheckEquals(expected, actual: string; msg: string);
+begin
+  AssertEquals(msg, expected, actual);
+end;
+
+
+class procedure TAssert.CheckEquals(expected, actual: extended;
+  delta: extended; msg: string);
+begin
+  AssertEquals(msg, expected, actual, delta);
+end;
+
+
+class procedure TAssert.CheckEquals(expected, actual: integer; msg: string);
+begin
+  AssertEquals(msg, expected, actual);
+end;
+
+
+class procedure TAssert.CheckEquals(expected, actual: boolean; msg: string);
+begin
+  AssertEquals(msg, expected, actual);
+end;
+
+
+class procedure TAssert.CheckEquals(expected, actual: TClass; msg: string);
+begin
+  AssertEquals(msg, expected, actual);
+end;
+
+
+class procedure TAssert.CheckNotEquals(expected, actual: string; msg: string);
+begin
+  if AnsiCompareStr(Expected, Actual) = 0 then
+    Fail(msg + ComparisonMsg(Expected, Actual));
+end;
+
+
+class procedure TAssert.CheckNull(obj: IUnknown; msg: string);
+begin
+  AssertNullIntf(msg, obj);
+end;
+
+
+class procedure TAssert.CheckNull(obj: TObject; msg: string);
+begin
+  AssertNull(msg, obj);
+end;
+
+
+class procedure TAssert.CheckNotNull(obj: TObject; msg: string);
+begin
+  AssertNotNull(msg, obj);
+end;
+
+
+class procedure TAssert.CheckIs(obj: TObject; pClass: TClass; msg: string);
+begin
+  Assert(pClass <> nil);
+  if obj = nil then
+    Fail(ComparisonMsg(pClass.ClassName, 'nil'))
+  else if not obj.ClassType.InheritsFrom(pClass) then
+    Fail(ComparisonMsg(pClass.ClassName, obj.ClassName));
+end;
+
+
+class procedure TAssert.CheckSame(expected, actual: TObject; msg: string);
+begin
+   AssertSame(msg, expected, actual);
+end;
+
+{$ENDIF read_implementation}
+

+ 143 - 6
fcl/fpcunit/fpcunit.pp

@@ -1,5 +1,3 @@
-{$mode objfpc}
-{$h+}
 {
     This file is part of the Free Component Library (FCL)
     Copyright (c) 2004 by Dean Zobec, Michael Van Canneyt
@@ -16,14 +14,28 @@
  **********************************************************************}
 unit fpcunit;
 
+{$mode objfpc}
+{$h+}
+
 interface
-{$define SHOWLINEINFO}
+{$DEFINE SHOWLINEINFO}
+{ Uncomment this define to remove the DUnit compatibility interface. }
+{$DEFINE DUnit}
 
 uses
   {$ifdef SHOWLINEINFO}
   LineInfo,
   {$endif}
-  SysUtils, Classes;
+  SysUtils
+  ,Classes
+  ;
+
+
+{ This lets us use a single include file for both the Interface and
+  Implementation sections. }
+{$define read_interface}
+{$undef read_implementation}
+
 
 type
 
@@ -56,6 +68,7 @@ type
   end;
   {$M-}
 
+
   TAssert = class(TTest)
   public
     class procedure Fail(const AMessage: string);
@@ -103,6 +116,10 @@ type
     class procedure AssertNotNull(const AString: string); overload;
     class procedure AssertException(const AMessage: string; AExceptionClass: ExceptClass; AMethod: TRunMethod); overload;
     class procedure AssertException(AExceptionClass: ExceptClass; AMethod: TRunMethod); overload;
+
+    {$IFDEF DUnit}
+      {$I DUnitCompatibleInterface.inc}
+    {$ENDIF DUnit}
   end;
 
   TTestFailure = class(TObject)
@@ -254,6 +271,13 @@ implementation
 uses
   testutils;
 
+
+{ This lets us use a single include file for both the Interface and
+  Implementation sections. }
+{$undef read_interface}
+{$define read_implementation}
+
+
 type
 
   TTestWarning = class(TTestCase)
@@ -263,26 +287,31 @@ type
     procedure RunTest; override;
   end;
 
+
 procedure TTestWarning.RunTest;
 begin
   Fail(FMessage);
 end;
 
+
 function ComparisonMsg(const aExpected: string; const aActual: string): string;
 begin
   Result := format(SCompare, [aExpected, aActual]);
 end;
 
+
 constructor EAssertionFailedError.Create;
 begin
   inherited Create('');
 end;
 
+
 constructor EAssertionFailedError.Create(const msg: string);
 begin
   inherited Create(msg);
 end;
 
+
 constructor TTestFailure.CreateFailure(ATest: TTest; E: Exception; LastStep: TTestStep);
 begin
   inherited Create;
@@ -293,6 +322,7 @@ begin
   FTestLastStep := LastStep;
 end;
 
+
 function TTestFailure.GetAsString: string;
 var
   s: string;
@@ -304,11 +334,13 @@ begin
   Result := s + FTestName + ': ' + FRaisedExceptionMessage;
 end;
 
+
 function TTestFailure.GetExceptionClassName: string;
 begin
   Result := FRaisedExceptionClass.ClassName;
 end;
 
+
 function TTestFailure.GetExceptionMessage: string;
 begin
   Result := FRaisedExceptionMessage;
@@ -318,16 +350,19 @@ begin
     Result := '[TEARDOWN] ' + Result;
 end;
 
+
 function TTestFailure.GetIsFailure: boolean;
 begin
   Result := FRaisedExceptionClass.InheritsFrom(EAssertionFailedError);
 end;
 
+
 procedure TTestFailure.SetTestLastStep(const Value: TTestStep);
 begin
   FTestLastStep := Value;
 end;
 
+
 { TTest}
 
 function TTest.GetTestName: string;
@@ -335,20 +370,25 @@ begin
   Result := 'TTest';
 end;
 
+
 function TTest.GetTestSuiteName: string;
 begin
   Result := 'TTest';
 end;
 
+
 function TTest.CountTestCases: integer;
 begin
   Result := 0;
 end;
 
+
 procedure TTest.Run(AResult: TTestResult);
 begin
+  { do nothing }
 end;
 
+
 { TAssert }
 
 class procedure TAssert.Fail(const AMessage: String);
@@ -356,57 +396,68 @@ begin
   raise EAssertionFailedError.Create(AMessage);
 end;
 
+
 class procedure TAssert.AssertTrue(const AMessage: String; ACondition: Boolean);
 begin
   if (not ACondition) then
     Fail(AMessage);
 end;
 
+
 class procedure TAssert.AssertTrue(ACondition: Boolean);
 begin
   AssertTrue('', ACondition);
 end;
 
+
 class procedure TAssert.AssertFalse(const AMessage: String; ACondition: Boolean);
 begin
   AssertTrue(AMessage, not ACondition);
 end;
 
+
 class procedure TAssert.AssertFalse(ACondition: Boolean);
 begin
   AssertFalse('', ACondition);
 end;
 
+
 class procedure TAssert.AssertEquals(const AMessage: string; Expected, Actual: string);
 begin
   AssertTrue(AMessage + ComparisonMsg(Expected, Actual), AnsiCompareStr(Expected, Actual) = 0);
 end;
 
+
 class procedure TAssert.AssertEquals(Expected, Actual: string);
 begin
   AssertEquals('', Expected, Actual);
 end;
 
+
 class procedure TAssert.AssertNotNull(const AString: string);
 begin
   AssertNotNull('', AString);
 end;
 
+
 class procedure TAssert.AssertEquals(const AMessage: string; Expected, Actual: integer);
 begin
   AssertTrue(AMessage + ComparisonMsg(IntToStr(Expected), IntToStr(Actual)), Expected = Actual);
 end;
 
+
 class procedure TAssert.AssertEquals(Expected, Actual: integer);
 begin
   AssertEquals('', Expected, Actual);
 end;
 
+
 class procedure TAssert.AssertEquals(const AMessage: string; Expected, Actual: int64);
 begin
   AssertTrue(AMessage + ComparisonMsg(IntToStr(Expected), IntToStr(Actual)), Expected = Actual);
 end;
 
+
 class procedure TAssert.AssertEquals(Expected, Actual: int64);
 begin
   AssertEquals('', Expected, Actual);
@@ -418,159 +469,190 @@ begin
   AssertTrue(AMessage + ComparisonMsg(FloatToStr(Expected), FloatToStr(Actual)), Expected = Actual);
 end;
 
+
 class procedure TAssert.AssertEquals(Expected, Actual: currency);
 begin
    AssertEquals('', Expected, Actual);
 end;
 
+
 class procedure TAssert.AssertEquals(const AMessage: string; Expected, Actual, Delta: double);
 begin
   AssertTrue(AMessage + ComparisonMsg(FloatToStr(Expected),FloatToStr(Actual)),
     (Abs(Expected - Actual) <= Delta));
 end;
 
+
 class procedure TAssert.AssertEquals(Expected, Actual, Delta: double);
 begin
   AssertEquals('', Expected, Actual, Delta);
 end;
 
+
 class procedure TAssert.AssertNotNull(const AMessage, AString: string);
 begin
   AssertTrue(AMessage, AString <> '');
 end;
 
+
 class procedure TAssert.AssertEquals(const AMessage: string; Expected, Actual: boolean);
 begin
   AssertTrue(AMessage + ComparisonMsg(BoolToStr(Expected), BoolToStr(Actual)), Expected = Actual);
 end;
 
+
 class procedure TAssert.AssertEquals(Expected, Actual: boolean);
 begin
   AssertEquals('', Expected, Actual);
 end;
 
+
 class procedure TAssert.AssertEquals(const AMessage: string; Expected, Actual: char);
 begin
   AssertTrue(AMessage + ComparisonMsg(Expected, Actual), Expected = Actual);
 end;
 
+
 class procedure TAssert.AssertEquals(Expected, Actual: char);
 begin
   AssertEquals('', Expected, Actual);
 end;
 
+
 class procedure TAssert.AssertEquals(const AMessage: string; Expected, Actual: TClass);
 begin
   AssertTrue(AMessage + ComparisonMsg(Expected.ClassName, Actual.ClassName), Expected = Actual);
 end;
 
+
 class procedure TAssert.AssertEquals(Expected, Actual: TClass);
 begin
   AssertEquals('', Expected, Actual);
 end;
 
+
 class procedure TAssert.AssertSame(const AMessage: string; Expected, Actual: TObject);
 begin
   AssertTrue(AMessage + ComparisonMsg(IntToStr(PtrInt(Expected)), IntToStr(PtrInt(Actual))),
     Expected = Actual);
 end;
 
+
 class procedure TAssert.AssertSame(Expected, Actual: TObject);
 begin
   AssertSame('', Expected, Actual);
 end;
 
+
 class procedure TAssert.AssertSame(const AMessage: string; Expected, Actual: Pointer);
 begin
   AssertTrue(AMessage + ComparisonMsg(IntToStr(PtrInt(Expected)), IntToStr(PtrInt(Actual))),
     Expected = Actual);
 end;
 
+
 class procedure TAssert.AssertSame(Expected, Actual: Pointer);
 begin
   AssertSame('', Expected, Actual);
 end;
 
+
 class procedure TAssert.AssertNotSame(const AMessage: string; Expected, Actual: TObject);
 begin
   AssertFalse(SExpectedNotSame, Expected = Actual);
 end;
 
+
 class procedure TAssert.AssertNotSame(Expected, Actual: TObject);
 begin
   AssertNotSame('', Expected, Actual);
 end;
 
+
 class procedure TAssert.AssertNotSame(const AMessage: string; Expected, Actual: Pointer);
 begin
   AssertFalse(SExpectedNotSame, Expected = Actual);
 end;
 
+
 class procedure TAssert.AssertNotSame(Expected, Actual: Pointer);
 begin
   AssertNotSame('', Expected, Actual);
 end;
 
+
 class procedure TAssert.AssertNotNull(const AMessage: string; AObject: TObject);
 begin
   AssertTrue(AMessage, (AObject <> nil));
 end;
 
+
 class procedure TAssert.AssertNotNull(AObject: TObject);
 begin
   AssertNotNull('', AObject);
 end;
 
+
 class procedure TAssert.AssertNotNullIntf(const AMessage: string; AInterface: IInterface);
 begin
   AssertTrue(AMessage, (AInterface <> nil));
 end;
 
+
 class procedure TAssert.AssertNotNullIntf(AInterface: IInterface);
 begin
   AssertNotNull('', AInterface);
 end;
 
+
 class procedure TAssert.AssertNotNull(const AMessage: string; APointer: Pointer);
 begin
   AssertTrue(AMessage, (APointer <> nil));
 end;
 
+
 class procedure TAssert.AssertNotNull(APointer: Pointer);
 begin
   AssertNotNull('', APointer);
 end;
 
+
 class procedure TAssert.AssertNull(const AMessage: string; AObject: TObject);
 begin
   AssertTrue(AMessage, (AObject = nil));
 end;
 
+
 class procedure TAssert.AssertNull(AObject: TObject);
 begin
   AssertNull('', AObject);
 end;
 
+
 class procedure TAssert.AssertNullIntf(const AMessage: string; AInterface: IInterface);
 begin
   AssertTrue(AMessage, (AInterface = nil));
 end;
 
+
 class procedure TAssert.AssertNullINtf(AInterface: IInterface);
 begin
   AssertNull('', AInterface);
 end;
 
+
 class procedure TAssert.AssertNull(const AMessage: string; APointer: Pointer);
 begin
   AssertTrue(AMessage, (APointer = nil));
 end;
 
+
 class procedure TAssert.AssertNull(APointer: Pointer);
 begin
   AssertNull('', APointer);
 end;
 
+
 class procedure TAssert.AssertException(const AMessage: string; AExceptionClass: ExceptClass;
   AMethod: TRunMethod);
 var
@@ -593,23 +675,33 @@ begin
   AssertTrue(Format(SExceptionCompare, [AExceptionClass.ClassName, ExceptionName])+ ': ' + AMessage, Passed);
 end;
 
+
 class procedure TAssert.AssertException(AExceptionClass: ExceptClass;
   AMethod: TRunMethod);
 begin
   AssertException('', AExceptionClass, AMethod);
 end;
 
+
+{ DUnit compatibility interface }
+{$IFDEF DUnit}
+  {$I DUnitCompatibleInterface.inc}
+{$ENDIF DUnit}
+
+
 constructor TTestCase.Create;
 begin
   inherited Create;
 end;
 
+
 constructor TTestCase.CreateWithName(const AName: string);
 begin
   Create;
   FName := AName;
 end;
 
+
 constructor TTestCase.CreateWith(const ATestName: string; const ATestSuiteName: string);
 begin
   Create;
@@ -617,16 +709,19 @@ begin
   FTestSuiteName := ATestSuiteName;
 end;
 
+
 function TTestCase.AsString: string;
 begin
   Result := TestName + '(' + ClassName + ')';
 end;
 
+
 function TTestCase.CountTestCases: integer;
 begin
   Result := 1;
 end;
 
+
 function TTestCase.CreateResult: TTestResult;
 begin
   Result := TTestResult.Create;
@@ -638,33 +733,39 @@ begin
   Result := FName;
 end;
 
+
 function TTestCase.GetTestSuiteName: string;
 begin
   Result := FTestSuiteName;
 end;
 
+
 procedure TTestCase.SetTestSuiteName(const aName: string);
 begin
   if FTestSuiteName <> aName then
     FTestSuiteName := aName;
 end;
 
+
 procedure TTestCase.SetTestName(const Value: string);
 begin
   FName := Value;
 end;
 
+
 function TTestCase.CreateResultAndRun: TTestResult;
 begin
   Result := CreateResult;
   Run(Result);
 end;
 
+
 procedure TTestCase.Run(AResult: TTestResult);
 begin
   (AResult).Run(Self);
 end;
 
+
 procedure TTestCase.RunBare;
 begin
   FLastStep := stSetUp;
@@ -679,6 +780,7 @@ begin
   FLastStep := stNothing;
 end;
 
+
 procedure TTestCase.RunTest;
 var
   m: TMethod;
@@ -700,22 +802,26 @@ begin
     end;
 end;
 
+
 procedure TTestCase.SetUp;
 begin
-
+  { do nothing }
 end;
 
+
 procedure TTestCase.TearDown;
 begin
-
+  { do nothing }
 end;
 
+
 constructor TTestSuite.Create(AClass: TClass; AName: string);
 begin
   Create(AClass);
   FName := AName;
 end;
 
+
 constructor TTestSuite.Create(AClass: TClass);
 var
   ml: TStringList;
@@ -743,6 +849,7 @@ begin
     AddTest(Warning(SNoValidTests + AClass.ClassName));
 end;
 
+
 constructor TTestSuite.Create(AClassArray: Array of TClass);
 var
   i: integer;
@@ -753,18 +860,21 @@ begin
       AddTest(TTestSuite.Create(AClassArray[i]));
 end;
 
+
 constructor TTestSuite.Create(AName: string);
 begin
   Create();
   FName := AName;
 end;
 
+
 constructor TTestSuite.Create;
 begin
   inherited Create;
   FTests := TFPList.Create;
 end;
 
+
 destructor TTestSuite.Destroy;
 begin
   FreeObjects(FTests);
@@ -772,32 +882,38 @@ begin
   inherited Destroy;
 end;
 
+
 function TTestSuite.GetTest(Index: integer): TTest;
 begin
   Result := TTest(FTests[Index]);
 end;
 
+
 function TTestSuite.GetTestName: string;
 begin
   Result := FName;
 end;
 
+
 function TTestSuite.GetTestSuiteName: string;
 begin
   Result := FTestSuiteName;
 end;
 
+
 procedure TTestSuite.SetTestName(const Value: string);
 begin
   FName := Value;
 end;
 
+
 procedure TTestSuite.SetTestSuiteName(const aName: string);
 begin
   if FTestSuiteName <> aName then
     FTestSuiteName := aName;
 end;
 
+
 function TTestSuite.CountTestCases: integer;
 var
   i: integer;
@@ -809,6 +925,7 @@ begin
   end;
 end;
 
+
 procedure TTestSuite.Run(AResult: TTestResult);
 var
   i: integer;
@@ -817,11 +934,13 @@ begin
     RunTest(TTest(FTests[i]), AResult);
 end;
 
+
 procedure TTestSuite.RunTest(ATest: TTest; AResult: TTestResult);
 begin
   ATest.Run(AResult);
 end;
 
+
 procedure TTestSuite.AddTest(ATest: TTest);
 begin
   FTests.Add(ATest);
@@ -829,11 +948,13 @@ begin
     ATest.TestSuiteName := Self.TestName;
 end;
 
+
 procedure TTestSuite.AddTestSuiteFromClass(ATestClass: TClass);
 begin
   AddTest(TTestSuite.Create(ATestClass));
 end;
 
+
 class function TTestSuite.Warning(const aMessage: string): TTestCase;
 var
   w: TTestWarning;
@@ -843,6 +964,7 @@ begin
   Result := w;
 end;
 
+
 constructor TTestResult.Create;
 begin
   inherited Create;
@@ -851,6 +973,7 @@ begin
   FListeners := TFPList.Create;
 end;
 
+
 destructor TTestResult.Destroy;
 begin
   FreeObjects(FFailures);
@@ -860,6 +983,7 @@ begin
   FListeners.Free;
 end;
 
+
 procedure TTestResult.ClearErrorLists;
 begin
   FreeObjects(FFailures);
@@ -868,26 +992,31 @@ begin
   FErrors.Clear;
 end;
 
+
 function TTestResult.GetNumErrors: integer;
 begin
   Result := FErrors.Count;
 end;
 
+
 function TTestResult.GetNumFailures: integer;
 begin
   Result := FFailures.Count;
 end;
 
+
 procedure TTestResult.AddListener(AListener: ITestListener);
 begin
   FListeners.Add(pointer(AListener));
 end;
 
+
 procedure TTestResult.RemoveListener(AListener: ITestListener);
 begin
   FListeners.Remove(pointer(AListener));
 end;
 
+
 procedure TTestResult.AddFailure(ATest: TTest; E: EAssertionFailedError);
 var
   i: integer;
@@ -901,6 +1030,7 @@ begin
   //unlock mutex
 end;
 
+
 procedure TTestResult.AddError(ATest: TTest; E: Exception;
   AUnitName: string; AFailedMethodName: string; ALineNumber: longint);
 var
@@ -918,6 +1048,7 @@ begin
   //unlock mutex
 end;
 
+
 procedure TTestResult.EndTest(ATest: TTest);
 var
   i: integer;
@@ -926,11 +1057,13 @@ begin
     ITestListener(FListeners[i]).EndTest(ATest);
 end;
 
+
 procedure ProtectTest(aTest: TTest; aResult: TTestResult);
 begin
   TTestCase(aTest).RunBare;
 end;
 
+
 procedure TTestResult.Run(ATestCase: TTestCase);
 begin
   StartTest(ATestCase);
@@ -938,6 +1071,7 @@ begin
   EndTest(ATestCase);
 end;
 
+
 procedure TTestResult.RunProtected(ATestCase: TTest; protect: TProtect);
 var
   func, source: shortstring;
@@ -961,6 +1095,7 @@ begin
   end;
 end;
 
+
 procedure TTestResult.StartTest(ATest: TTest);
 var
   count: integer;
@@ -974,6 +1109,7 @@ begin
   //unlock mutex
 end;
 
+
 function TTestResult.WasSuccessful: boolean;
 begin
 //lock mutex
@@ -982,3 +1118,4 @@ begin
 end;
 
 end.
+

+ 3 - 2
fcl/fpcunit/testdecorator.pp

@@ -1,5 +1,3 @@
-{$mode objfpc}
-{$h+}
 {
     This file is part of the Free Component Library (FCL)
     Copyright (c) 2005 by Dean Zobec
@@ -17,6 +15,9 @@
 
 unit testdecorator; 
 
+{$mode objfpc}
+{$h+}
+
 interface
 
 uses