[racket] Racket unit testing, was Re: date format conversion

From: Robby Findler (robby at eecs.northwestern.edu)
Date: Sun Feb 13 11:11:03 EST 2011

On Sun, Feb 13, 2011 at 9:45 AM, Stefan Schmiedl <s at xss.de> wrote:
> On Sun, 13 Feb 2011 07:27:35 -0600
> Robby Findler <robby at eecs.northwestern.edu> wrote:
>
>> On Sun, Feb 13, 2011 at 3:20 AM, Stefan Schmiedl <s at xss.de> wrote:
>> >
>> > Are there specific reasons or situations when using
>> >
>> >        (require test-engine/racket-tests)
>> >
>> > is "superior" to using the test framework provided in
>> >
>> >        (require rackunit) ?
>>
>> No apriori reason, no. The two evolved independently,
>> test-engine/racket-tests was originally designed as part of the
>> teaching languages and so makes design decisions that are better
>> suited there (specifically for showing the results of test case
>> failures). rackunit was designed for the full languages and I believe
>> it has more features for putting tests together into test suites and
>> support for adding your own kind of test cases and extending existing
>> ones.
>>
>> And there is also a third unit test framework that Eli wrote that
>> takes the position that it should be minimal, punting things like test
>> suites into Racket itself (by using functions, say). I'm not sure if
>> that last one is included in the documentation.
>
> I went and looked around a bit. Is this what you're referring to?
>
> (require tests/eli-tester)
>
> (test
>  #t
>  (< 1 2)
>  (+ 1 2) => 3
>  (quotient/remainder 10 3) => (values 3 1)
>  (car '()) =error> "expects argument of type")
>
> Very compact and avoids the problem of "what comes first" that I usually
> have with other frameworks :-)

Yes, that's the one, although Eli has promised that the first and
second subexpressions in the above won't be valid syntax in a
hopefully soon-to-come revision. (The problem being that if you forget
to put an => in, then you turn one failing test case into two passing
ones.)

Robby



Posted on the users mailing list.