Utility functions for tests.

- moved from spec-error.js
- added one to create a test Fcommand and remove it at the end of the
  enclosing test