example from Jim Dew. Add some simple regression tests, since this is an area we seem to break regularly :-(