[racket] running test-suites in module+ tests

From: J. Ian Johnson (ianj at ccs.neu.edu)
Date: Tue Aug 27 09:11:29 EDT 2013

Before you go and write a parser for rackunit output, realize that you can get a value that holds the outcomes of testing by using run-test.
-Ian
----- Original Message ----- 
From: Chad Albers <calbers at neomantic.com>
To: Matthias Felleisen <matthias at ccs.neu.edu>
Cc: users at racket-lang.org
Sent: Tue, 27 Aug 2013 01:57:53 -0400 (EDT)
Subject: Re: [racket] running test-suites in module+ tests

Thanks.  I swear I tried that, and I couldn't get it to work.

It's a bit awkward, though, because of the mixed output.  "raco test"
has a very simplied (and parseable) test output.   Mixing it with
(run-tests) has a mixed output.  On failure, (run-test) gives the
number of tests failed.  And then depending on the verbosity setting
of (run-test), I get even more output.  If I decide to automate my
test suite, that adds a new layer of complication. I'm still working
out my guard-rackunit plans (if I have any).

Chad
--
Chad Albers


On Sun, Aug 25, 2013 at 11:47 AM, Matthias Felleisen
<matthias at ccs.neu.edu> wrote:
>
> Does this help:
>
>> #lang racket
>>
>> (module+ test
>>   (require rackunit))
>>
>> ;; ---
>>
>> (module+ test
>>   (define-test-suite for-f
>>     (check-equal? (f 10) 10)
>>     (check-equal? (f 11) 12)))
>>
>> (define (f x)
>>   x)
>>
>>
>> (module+ test
>>   (require rackunit/text-ui)
>>   (run-tests for-f))
>
>
>
> On Aug 24, 2013, at 10:39 PM, Chad Albers wrote:
>
>> Hi,
>>
>> I'm exploring rolling my tests into the source files they cover using
>> the (module+ test...) form.
>>
>> Can I include (test-suite ...) statements in the module, and if so,
>> how do I get it to work?  I've haven't managed to get it to work with
>> raco test.
>>
>> Thanks,
>> --
>> Chad
>> ____________________
>>  Racket Users list:
>>  http://lists.racket-lang.org/users
>
____________________
  Racket Users list:
  http://lists.racket-lang.org/users


Posted on the users mailing list.