Initial port of the tests.
Fix a typo.
Refactor the error reporting system.
Fix a typo.