[Lazarus] Bored?

Michael Van Canneyt michael at freepascal.org
Tue Apr 16 11:12:53 CEST 2013



On Tue, 16 Apr 2013, Graeme Geldenhuys wrote:

> On 16/04/13 09:40, Michael Van Canneyt wrote:
>>
>> I understand, but then I'd be stuck with lots of useless warnings,
>> since there is no way to differentiate a real from a false one.
>>
>> Better no warnings than lots of false warnings.
>
> I don't understand you statement. What false warnings? The test didn't
> actually do any checks - so shouldn't be considered a valid test case.

You didn't look at my example very careful.

I give it in simplified form:

Procedure TTestSomething.MyTest;

begin
   If (MyObject.MyProperty<>'') then
     Fail('MyProperty must be empty');
end;

For a string, you would probably use AssertEquals, but there are lots of 
cases where you cannot use AssertEquals, as there is nothing to be equal to.

The above kind of construct tests all it needs to test, yet does not call AssertEquals.

Since no AssertEquals is called, it will give a false warning in your test framework.

Michael.




More information about the Lazarus mailing list