[racket] Thoughts on Overeasy

From: Eli Barzilay (eli at barzilay.org)
Date: Sun Aug 28 01:02:00 EDT 2011

30 minutes ago, Neil Van Dyke wrote:
> However, in the future, I would like to treat the "#:val" and
> "#:exn" specially, but to make all the effects testing be plugins,
> for extensibility.  The "test" macro could then consult the test
> context to get the sequence of effects to be tested, and would use
> the that info for parsing unfamiliar keyword arguments and for
> evaluating the result.

This is exactly what I have in the future of my tester ("have" not in
a complete vaporware sense, but as stuff that's already working and
committed in my repo).  You basically get a macro that defines new
arrow types

  (define-test-arrow-rule (X =output> Y)

and this macro set up the output redirection before the test, and
checking the collected output after it.  Such macros are not really
easy to write, but there's still a huge advantage in the fact that
they can be added for new kinds of side-effect testing, without being
tied down to some specific subset.

> > Since test must be a macro, it should capture location and report
> > that when a test fails.
> Agreed.  I almost added this originally, and it is on my TODO list.
> I would like one of the report handlers to make messages that Emacs
> "compile" will understand.

(IMO, this should be the first thing in any testing facility, and
getting Emacs-friendly messages is very easy.)

> > "No special forms for setup and tear-down are required, nor are
> > they provided."  I believe a test library should provide these
> > conveniences around dynamic-wind.

I don't see what's wrong with using `dynamic-wind' directly:

  (dynamic-wind setup
                (λ () (test ...))

It has a huge advantage of already being there, separate from the the
testing facility, and I didn't see any use that needs something
special.  I think that it's even less likely that there's something
special that is needed that is *not* also needed outside of a testing
framework -- for example, some unroll-on-abort thing is obviously
useful outside of testing.  Keeping things separate is always a good
idea IMO.

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

Posted on the users mailing list.