[racket] how to test syntax extensions

From: Matthias Felleisen (matthias at ccs.neu.edu)
Date: Sun Jan 20 17:32:44 EST 2013

	

On Jan 20, 2013, at 6:35 AM, Tim Brown wrote:

> Or are you starting a "design recipe" yourself with the "GOAL", "STEP
> 1"...?
> 
> The reason I ask is this: before I received your answer this evening, I
> was going to re-attack the problem; either by taking the opportunity to
> look at the design recipe in HTDP (which I haven't done much more than
> skim read a long time ago) or to "TDD as if you (I) mean it".
> 
> In either case, I considered a problem; how do you unit-test macros?


I have taken this part of your message to a separate thread
and I have cc'ed the people who know more about this than I 
do. [No, they are not older, but they write more complex macros
than I do. Mine always fit on a page and into a handful of modules.] 

I personally don't test/debug syntax definitions much. 
My path is almost always: 
 
 define-syntax with syntax-rules 
 to 
 define-syntax with syntax-cases or syntax-parse these days. 

(Unless it is obvious.) 

I write a few small use cases in the same module that trigger the 
essential parts and I test them by testing run-time values. 

I start from simple definitions and add bells and whistles slowly. 
The macro stepper is my main friend along this path. 

---------------------------------------------------------------

I have proposed the exploration of a unit testing system many 
times. Usually I get a speech on why this is not what I want. 
I never understand and I never have time to rebut on the spot. 
So I let it sink in and I try differently a few months later. 

Perhaps it is going to be written down this time, and then I 
can look it up in the future. Better for my old brain 

-- Matthias

 

Posted on the users mailing list.