[racket-dev] Testing mode

From: Eli Barzilay (eli at barzilay.org)
Date: Tue Jun 28 10:02:38 EDT 2011

About a minute ago, Matthias Felleisen wrote:
> I have come to accept that all modules should come with their tests
> included, as an exportable test suite:
> -- you don't need to expose any 'private' identifiers
> -- they are next to the function they test
> -- it is easy to run them from the repl after loading the file
> -- ... and from some 'test all' file
> BUT, I'd like two additions: 
> -- run the tests automatically when the file is required in a
>    certain into racket or always into DrRacket's repl
> -- if code size is a concern, racket should be able to eliminate
>    tests

I don't see this happen any time soon...  How can you trim the file?
For example, say that your tests use the rackunit gui thing -- you
don't want to get *that* overhead whenever you want to just run the
file.  The missing bit here is a new language-level extension -- some
lazy-require thing.  (I've made such things here and there using
`dynamic-require', but they are hacks.)

I do see a point in such a feature -- for example, IIUC, Matthew's
recent optimization to loading phase-1 code could be expressed inside
the language by making all `for-syntax' requires default to lazy
loading mode.  But I doubt that such a thing will be added in the near

> That's what I asked for, and this is what Jay's patch is supposed to
> address though I don't see how it does. Also, like Eli, I don't like
> the additional wrappers and with-deployment looks suspicious.

Yes, I know what you asked for -- and Jay's thing is not addressing
that at all.  My proposal (on the other thread) does, and avoids the
need for new wrappers.

          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                    http://barzilay.org/                   Maze is Life!

Posted on the dev mailing list.