Test eof is reached when parsing format strings

Otherwise extra stuff after a lone '}' character is simply ignored, which is
very bad.

Closes #8938