Tuesday, December 18, 2007

Quis custodiet ipsos...

I don't know what this says about Lispers' attitudes toward automated testing, or toward the RT test framework, but the commonly-distributed versions of the RT test framework did not pass their own self-tests.

The apparent cause is that the introduction of a hash-table and tail-pointer in rt.lisp to efficiently find tests by name and insert new tests at the end of the test list were not matched by the updating of the rt-test.lisp to consistently construct the miniature mock-up test suite. This diff for rt-test.lisp, introduces code to dynamically rebind those variables. The patch, in addition to one putting the self-tests into a separate package, has been applied to the HEAD of the CVS repository for GNU CLISP. Note that changing the package changes the names of the tests themselves, which requires editing the expected output in the tests.

Note how powerful and convenient the dynamic binding feature of Lisp (optional, as it should be, in Common Lisp) can be: while running the individual tests, the test procedure can effortlessly construct a sandbox in which to test out the features of the test suite, without destroying the suite of tests that is being sequenced through, and automatically restoring the state of the outer test suite as each test completes, even if the inner test throws an unexpected error---all with essentially no special effort on the part of the original programmer (except, as we see, to identify all of the state that needs to be shadowed.)

No comments:

Post a Comment