TestCase: set locale from the environment
authorSimon McVittie <simon.mcvittie@collabora.co.uk>
Wed, 20 Mar 2013 11:34:37 +0000 (11:34 +0000)
committerSimon McVittie <simon.mcvittie@collabora.co.uk>
Wed, 20 Mar 2013 16:43:11 +0000 (16:43 +0000)
This fixes an annoyance I'd had for a while: UTF-8 arrows etc.
in debug messages came out as "?", because until we call setlocale()
we're in the C locale, whose character set is ASCII (and some layer
of library responds by transcoding our strings into ASCII).

With this change, running the tests in en_GB.UTF-8 results in
Unicode arrows and more comprehensible output.

Bug: https://bugzilla.gnome.org/show_bug.cgi?id=696179
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Philip Withnall <philip@tecnocode.co.uk>
tests/lib/test-case.vala

index 3956999..c2a211a 100644 (file)
@@ -39,6 +39,8 @@ public abstract class Folks.TestCase : Object
 
   public TestCase (string name)
     {
+      Intl.setlocale (LocaleCategory.ALL, "");
+
       LogAdaptor.set_up ();
       this._suite = new GLib.TestSuite (name);