[racket] Can `raco test ...' return non 0 values?

From: Diogo F. S. Ramos (diogofsr at gmail.com)
Date: Wed Mar 20 13:14:57 EDT 2013

Jay McCarthy <jay.mccarthy at gmail.com> writes:

> raco test's job is to run the 'test' modules of the programs listed.
> It imposes no obligations on what these test modules do and does not
> communicate with them in any way. Thus, it has no concept of "a check
> failing".

I see.

> There's a good reason that 'rackunit' doesn't work this way, but if
> you disagree with that design, you could use a different testing
> system and 'raco test' would respect it.

"rackunit" is great so I think there might be a better alternative than
just using a different testing system.

> If you want, you can write your test modules so that they exit with
> non-0 when they fail, which raco test will pass on to you:
>
> (module+ test
>  (unless (= 0 (f 5))
>   (error 'test-failure "F of 5 is not 0!")))
>
> If this is your test module, then raco test will return a non-0
> because 'error' returns a non-0.

What I'm thinking about is something more subtle than that.

All the tests should be checked, even if some fail, but if some fail,
there is a non-0 value returned.

This is nice to have when you're automating tests so you don't have to
visually check for errors.

Is this possible?

As a "test" module using "rackunit" always returns 0 I presume that
making this change, if it's actually possible, won't break stuff.

Posted on the users mailing list.