Browse Source

* Patch from Dean Zobec
- memory leaks fixed in the money example;
- no more need to start the test methods with "test"

michael 20 years ago
parent
commit
643f7c3ece
2 changed files with 9 additions and 10 deletions
  1. 2 4
      fcl/fpcunit/README.txt
  2. 7 6
      fcl/fpcunit/tests/suitetest.pp

+ 2 - 4
fcl/fpcunit/README.txt

@@ -40,11 +40,9 @@ and you'll inherit all your testcases from TMoneyTestCase;
 
 
 
 
 Your testcase class will have a set of published methods, one for each test.
 Your testcase class will have a set of published methods, one for each test.
-Each test method name has to begin with "test",  as the framework picks up all the published methods that begin with the string "test" and registers them as tests in the suite.
-It will skip all the other published methods in the class. This way it's easy to temporarily disable a test from the suite: I suggest to prepend a "Todo" or some meaninfull string to it's name:
+The framework picks up all the published methods and registers them as tests in the suite.
+It's easy to temporarily disable a test from the suite: just move the declaration to the public section.
 
 
-published
-  TodoTestAdd(...
 
 
 The fact that all assertions are static (class methods) make's it possible to use them outside of the test case, by simply adding fpcunit to your uses clause: 
 The fact that all assertions are static (class methods) make's it possible to use them outside of the test case, by simply adding fpcunit to your uses clause: 
 e.g. by calling TAssert.AssertEqual(....)
 e.g. by calling TAssert.AssertEqual(....)

+ 7 - 6
fcl/fpcunit/tests/suitetest.pp

@@ -25,7 +25,7 @@ uses
 type
 type
 
 
   TNoTestCases = class(TTestCase)
   TNoTestCases = class(TTestCase)
-  published
+  public
     procedure NoTestCase;  
     procedure NoTestCase;  
   end;
   end;
   
   
@@ -37,14 +37,15 @@ type
   {$M-}
   {$M-}
   
   
   TOneTestCase = class(TTestCase)
   TOneTestCase = class(TTestCase)
-  published
+  public
     procedure NoTestCase;
     procedure NoTestCase;
-    procedure TestCase; virtual;
+  published
+    procedure OnlyOneTestCase; virtual;
   end;
   end;
 
 
   TOverrideTestCase = class(TOneTestCase)
   TOverrideTestCase = class(TOneTestCase)
   published
   published
-    procedure TestCase; override;
+    procedure OnlyOneTestCase; override;
   end;
   end;
 
 
   
   
@@ -87,11 +88,11 @@ procedure TOneTestCase.NoTestCase;
 begin
 begin
 end;
 end;
 
 
-procedure TOneTestCase.TestCase;
+procedure TOneTestCase.OnlyOneTestCase;
 begin
 begin
 end;
 end;
 
 
-procedure TOverrideTestCase.TestCase;
+procedure TOverrideTestCase.OnlyOneTestCase;
 begin
 begin
 end;
 end;