Test coverage machinery. Works for me.

This would fix #522. I could imagine adding a switch so that it only generates in some contexts, but I don't know that that's worth the trouble. We could look at the report on my machine.