[racket] Thoughts on Overeasy
Eli Barzilay wrote at 08/29/2011 04:04 AM:
> But all of that is unrelated to *testing*. By keeping things
> separate: not implementing such a form in a testing framework and
> referring people to the language for such things, you get more focused
> work, and if the language gets a better replacement form, then your
> testing library gets that too.
>
I agree in general, especially for general programming in the Racket
language.
However, in response to Noel's suggestion, I'm thinking that there might
be a place for some dumbed-down syntactic sugar for simple forms of
setup and teardown. Specifically, "#:setup" and #:teardown" keyword
arguments that are followed by expressions, and then expanded to
something like "(dynamic-wind (lambda () SETUP) (lambda () CODE) (lambda
() TEARDOWN)". Part of the rationale is that Overeasy might be
considered a minilanguage for testing, perhaps used by a software test
engineer, and by incorporating the setup and teardown into the "test"
form, "test" can provide a nice little self-contained specification of
most individual tests. When the dumbed-down syntactic sugar is
adequate, it's prettier.
Note that this "#:setup" and "#:teardown" are not adequate for a single
setup that is done for a sequence of more than one test. Also, this
"#:setup" and "#:teardown" alone are not adequate for things like
opening a database connection that yields a handle object that "#:code"
must reference. ("dynamic-wind" is alone is not adequate for that
either. Perhaps it would be easier to solve for a more restrictive
relative of "dynamic-wind", which had a continuation barrier, so that
"pre-thunk" could yield the database handle, and then that value would
be passed to "value-proc" and "post-proc".)
I remain adamant that pretty much the entire Racket language should be
available for intermixing with "test" in Overeasy, of course. Missing
that was one of several ways that Testeez was unnecessarily dumb. But I
am leaning towards *in addition* having sugar like "#:setup" and
"#:takedown".
--
http://www.neilvandyke.org/