return values Alex Shinn (04 Feb 2005 01:57 UTC)
Re: return values Per Bothner (08 Feb 2005 01:09 UTC)
Re: return values Alex Shinn (08 Feb 2005 02:20 UTC)

Re: return values Per Bothner 08 Feb 2005 01:08 UTC

Alex Shinn wrote:
> What do the test-* assertions return?

As currently specified/implemented the result is undefined.

> For test cases it can be very
> useful to return a boolean value so that additional information can be
> displayed when the test fails (or errors) unexpectedly.

But why should that be part of the test suite, rather than the
test runner?  I.e. I would *expect* a test runner to display "additional
information" when a test fails unexpectedly.

I can see when debugging either a test-suite or when trying to figure
out why a test failed you might want to print extra information.
But in that case you'd typically edit the test suite *temporarily*,
perhaps simplifing it, perhaps writing the state of variables, etc.
But that's debugging, not testing: you'd change it back when you've
figured it out.

> The true values could be just #t or more descriptive symbols like 'pass, 'skip,
> 'fail, 'error.

Woould it be more useful to be able to test the most recent result.
E.g. rather than
   (if (eq? 'fail (test-assert ...))) ...
do:
   (test-assert ...)
   (if (eq? 'fail (test-result-last)) ...)
or something like that.

This has the advantage that you're not changing the existing test code;
just adding to it.
--
	--Per Bothner
xxxxxx@bothner.com   http://per.bothner.com/