[geocode-glib/wip/hadess/fix-pi-locale] tests: Fix locale in "pi" test




commit 464bb3bae5525566a7f41d157f73575cc4f3b5f8
Author: Bastien Nocera <hadess hadess net>
Date:   Sat Jul 2 10:11:10 2022 +0200

    tests: Fix locale in "pi" test
    
    The test expects the locale to be en_GB.UTF-8, so set it as such.
    
    Closes: #27

 geocode-glib/tests/geocode-glib.c | 6 ++++++
 1 file changed, 6 insertions(+)
---
diff --git a/geocode-glib/tests/geocode-glib.c b/geocode-glib/tests/geocode-glib.c
index f74d031..88b39c1 100644
--- a/geocode-glib/tests/geocode-glib.c
+++ b/geocode-glib/tests/geocode-glib.c
@@ -410,10 +410,14 @@ test_pi (void)
 {
        g_autoptr (GHashTable) params = NULL;
        GeocodeForward *object;
+       g_autofree char *old_locale = NULL;
        GError *error = NULL;
        GList *res;
        GeocodePlace *place;
 
+       old_locale = g_strdup (setlocale(LC_MESSAGES, NULL));
+       setlocale (LC_MESSAGES, "en_GB.UTF-8");
+
        /* The query parameters the mock server expects to receive. */
        params = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, NULL);
        add_attr_string (params, "q", "Jack Cole Building, St Andrews");
@@ -439,6 +443,8 @@ test_pi (void)
        g_assert_cmpstr (geocode_place_get_street_address (place), ==, "North Haugh π");
        g_object_unref (place);
        g_list_free (res);
+
+       setlocale (LC_MESSAGES, old_locale);
 }
 
 static void


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]