Fix and augment TestCommand tests.

Fixes #996.