GNOME Bugzilla – Bug 669285
glib/tests/markup-parse fails under non-english locale
Last modified: 2012-04-13 13:44:58 UTC
/markup/parse/fail-15.gmarkup: ** ERROR:markup-parse.c:268:test_parse: assertion failed (string->str == expected): ("ELEMENT 'foo'\n TEXT '\n'\n ELEMENT 'bar'\n TEXT '\n'\n END 'bar'\nERROR Fehler in Zeile 3, Zeichen 8: Dokument endete unerwartet mit noch offenen Elementen - \302\273foo\302\253 war das letzte offene Element\n" == "ELEMENT 'foo'\n TEXT '\n'\n ELEMENT 'bar'\n TEXT '\n'\n END 'bar'\nERROR Error on line 3 char 8: Document ended unexpectedly with elements still open - 'foo' was the last element opened\n") Due to commit 08e17ae51b6336d059b0cc85071cc26772ab2f0c. Now this one's commit msg says that it's necessary to call setlocale... but if that's true shouldn't the testcase make sure to use an english locale, so that strcmp on error msgs works? Or, if we don't support running the test suite under non-english locale, the makefile should ensure this by setting LANG or LC_ALL for make check. I guess this problem may exist for some other tests, too.
I see this in glib/tests/date.c and glib/tests/markup-parse.c I guess there's also the possibility of marking the strings in the test cases for translation, but that depends on having a fully translated module to work I guess.
The following fix has been pushed: 50aed1c Make the markup-parse test independent of the locale
Created attachment 211994 [details] [review] Make the markup-parse test independent of the locale I added a setlocale call, because we need it for Unicode to come out right; but I forgot to fix the locale, so we now fail when comparing error messages to the expected (English) result. Correct this by setting LANG explicitly to en_US.utf-8.