[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Converting DejaGNU tests to Paul's test/assert infrastructure
From: |
Paul Kienzle |
Subject: |
Re: Converting DejaGNU tests to Paul's test/assert infrastructure |
Date: |
Tue, 25 Oct 2005 02:22:27 -0400 |
On Oct 24, 2005, at 9:20 AM, David Bateman wrote:
However, nested functions are not permitted with Paul's test
infrastructure. I haven't looked at test.m yet to see, but how
complicated would it be to include nested functions in test.m?
You should now be able to build test function blocks with the function
name being the name of a shared variable which will last until the end
of the test or until the next 'shared' block.
Another issue I have is that although "%!error" exists there is no
equivalent "%!warning" for the warning conditions. Again how
complicated would it be to add this?
Octave can only test the first warning since lastwarn isn't updated
after the first warning. Presumably it resets itself after returning to
the prompt. Also the warnings will be displayed during the test.
Regardless, I've added a warning block similar to the error block:
%!warning warning("message text")
If you want to check the contents of the warning or error message, then
use the new syntax '%!error <pattern> code'. For example:
%!error <nonconformant> [1,2,3]*[4,5,6]
%!warning <division by zero> 5/0
Pattern can be any regular expression on the string with leading
'error: ' and trailing '\n' stripped off.
I first extended the 'fail' command to allow
fail(code,'warning',pattern) which will check the value of lastwarn
against the pattern, but I decided the tests looked too ugly.
- Paul