[racket] Getting test-engine to work with #lang racket

From: Luke Vilnis (lvilnis at gmail.com)
Date: Sun Sep 18 21:22:53 EDT 2011

Thanks guys, that works! Still, it's pretty confusing that running
(test)from the repl does not work, only inserting it at the end of the
file. It
would be nice to mention that in the docs, something like:

"Note that the check forms only register checks to be performed. The checks
are actually run by the test function."


"Note that the check forms only register checks to be performed. The checks
are actually run by the test function, which should be called at the end of
the file. Using test in the REPL will not run check forms declared in the

I'm not really sure that's the best way to phrase it, but something like
that definitely would have saved me a few hours. I could submit that as a
patch if anyone else thinks its worth mentioning.

One other question: since (test) must be added explicitly, what does the
Enable/Disable Tests option in the Racket menu do? It doesn't appear to
affect the automatic test-running of "Beginning Student" either. It could be
a bug, but I'd be willing to bet that I'm missing something else basic here
as well.

On Sun, Sep 18, 2011 at 8:30 PM, Stephen Bloch <sbloch at adelphi.edu> wrote:

> On Sep 18, 2011, at 8:21 PM, Luke Vilnis wrote:
> I was wondering how to get test-engine working with #lang, or non-student
> languages in general. I tried something like this:
> #lang racket
> (require test-engine/racket-tests)
> (check-expect 12 (+ 6 7)) ;;sic
> But no luck. I also tried it with (require test-engine/racket-gui),
> but I'm guessing I must be missing something really basic here because I
> can't even get it to work textually. I type (run-tests), (test),
> (display-results), pretty much anything I can think of at the repl, and I
> get nothing. It's as if all my output is going to some hidden buffer
> somewhere. It works fine (sans the require) using HTDP languages, so I
> don't think it's a problem with my install.
> Did you try (test) at the end of the definitions pane?
> In the student languages, check-expect is given the magical ability to run
> automatically after a complete pass through everything else.  I haven't
> looked at the code for test-engine/racket-tests, but that version of
> check-expect is less magical: it still doesn't run immediately (so you can
> still put test cases for a function ahead of the function's definition), but
> you have to explicitly say "(test)" to get it to run at all.
>  Stephen Bloch
> sbloch at adelphi.edu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20110918/048bf318/attachment.html>

Posted on the users mailing list.