Silence error logging while running tests that are intended to produce errors

The errors in the test log are distracting, making it look like
a test actually failed.
Remove an unused variable

This fixes build warnings with clang on OS X.
Merge pull request #1153 from mstorsjo/silence-error-testing

Silence error logging while running tests that are intended to produce errors
Merge pull request #1167 from mstorsjo/remove-unused-variable

Remove an unused variable