[racket-dev] RFC: Coding Guidelines

From: Sam Tobin-Hochstadt (samth at ccs.neu.edu)
Date: Thu Aug 19 10:01:46 EDT 2010

On Thu, Aug 19, 2010 at 9:48 AM, Robby Findler
<robby at eecs.northwestern.edu> wrote:
> On Thu, Aug 19, 2010 at 8:44 AM, Sam Tobin-Hochstadt <samth at ccs.neu.edu> wrote:
>> On Tue, Aug 17, 2010 at 3:57 PM, Jay McCarthy <jay.mccarthy at gmail.com> wrote:
>>> Please comment.
>> I think that this:
>> "Your first task when changing old code is to build an adequate test
>> suite to ensure you do not introduce new mistakes as you attempt to
>> improve it. Thank you for improving the world for future generations!"
>> is too demanding.  There are enormous areas of our code that don't
>> have a test suite.  How comprehensive a test suite do I need before
>> changing slideshow?  Or scribble (which has a test suite for the
>> syntax, but not the language)?
> You should make a reasonable effort to put in a test case or two for
> the specific functionality that you're adding/modifying. If there is
> no test suite and you aren't sure how to build one, then ask, see what
> responses you get, and go from there.

So, to make this concrete, I recently made some small changes to the
scriblib/autobib library.  These included changing the regexp to allow
hyphens in last names, as well as allowing multiple citations at once
in a particular special case.  I tested these changes by running a
not-then-published paper that I was working on, and seeing that it did
the right thing.  Then I sent the patch to Matthew, and he said it
looked good.  Then I committed it.

There's two forms of automated test that I could have added.  I could
have just added a file the used the functionality, and checked that it
didn't error when run.  That would have been a minimal test, and
wouldn't even have exercised the bug fix (it was just parsing my name
wrong).   Or I could have written a test framework for Scribble PDF
rendering.  I'm not sure how that would have worked, and it would have
been a big programming investment.  I don't think I had time then (or
now) to do that work.

For Typed Racket, testing is a hard problem, but one that I've put a
bunch of effort into making possible, because it needs testing.  But
there's no way I'd expect someone else to put that effort in.
sam th
samth at ccs.neu.edu

Posted on the dev mailing list.