Code review comment for lp:~michihenning/unity/phablet-unity-api-merge-tests

Revision history for this message
Michi Henning (michihenning) wrote :

I'm not aware of a better way of doing this.

For unity::Exception and its derived exceptions, all of the text that is tested for is actually produced by the application that throws the exception. The only bits of text that come from the Exception implementation itself are the "Exception #n:" and "Exception history:" labels. Right now, these are hard-wired into the implementation, so they can't change even if the locale changes.

For the FileIO exceptions, I add the output from strerror() to the exception string, so that string can change if the locale changes. The easiest thing would probably be to set the LOCALE to "C" at the start of the test. Yes, it's possible for a different libc to use slightly different strings but, in practice, I don't think that's a problem. (It would be easier to adjust the tests if/when that happens than trying to come up with machinery now to deal with this, just in case we encounter a problem that, in fact, we may never encounter.)

Note that I don't want to just drop those tests because, without them, we have no guarantee that the strings are actually correct. (For example, I sometimes find myself catching typos I made in a string when I'm writing the tests.)

« Back to merge proposal