Add tests for exceptional cases (close gh-6).