[fpc-pascal] Testing if exception raised in fpcUnit
ik
idokan at gmail.com
Mon Nov 5 13:18:40 CET 2012
Hello,
I wish to test if a method has raised an exception for a value
(something that should make the test pass) or not.
For example:
function TestNum(ch : Char) : Byte;
begin
if UpCase(ch) in ['A'..'F', '0'..'9'] then
...
else
raise Exception.Create('Invalid char was given.');
end;
I want to test the code with Char like 'y' for example, to make sure
that it does raises the exception.
Does AssertException is the proper method for such test ?
Thanks,
Ido
More information about the fpc-pascal
mailing list