* Patch from Dean Zobec

- memory leaks fixed in the money example;
  - no more need to start the test methods with "test"
This commit is contained in:
michael 2004-12-08 21:00:23 +00:00
parent 123f82f176
commit 643f7c3ece
2 changed files with 9 additions and 10 deletions

View File

@ -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.
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:
e.g. by calling TAssert.AssertEqual(....)

View File

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