DISQUS

Phil Dawes' Stuff: A simple scheme unittest DSL

  • Nat · 2 years ago
    Wouldn't a really Scheme-y macro rewrite the tests to use call/cc to pass the continuation into the test function and rewrite the asserts to call the continuation to jump out of the test when the assert failed?
  • Phil Dawes · 2 years ago
    Hi Nat,

    Actually using continuations was the original plan but it turned out to be more tricky than I'd expected because of syntax-rules macro hygiene.

    The problem is that the inner assert macro can't just use the symbol for the continuation because it gets masked, so IIRC the outer macro needs to traverse the code re-writing the assert calls to include the continuation as an argument - it was doing that where I came a bit unstuck and switched to the exception hack.
    Hmmm... maybe I should revisit this.