X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=tests%2Funicode-collate.c;h=b276a2f67410a322e44d4b3bcd3b5f66a3a8a50a;hb=ea4f9ce8a060d53cbc299e4c384089f6cc926caa;hp=009b00fa0ee0ab07b6a623ff44ea23e728c69a3f;hpb=d433419b14cb71cbdb0f23d375af9ec596e21d5c;p=platform%2Fupstream%2Fglib.git diff --git a/tests/unicode-collate.c b/tests/unicode-collate.c index 009b00f..b276a2f 100644 --- a/tests/unicode-collate.c +++ b/tests/unicode-collate.c @@ -5,6 +5,7 @@ #include #include #include +#include typedef struct { const char *key; @@ -12,7 +13,7 @@ typedef struct { } Line; -int +static int compare_collate (const void *a, const void *b) { const Line *line_a = a; @@ -21,7 +22,7 @@ compare_collate (const void *a, const void *b) return g_utf8_collate (line_a->str, line_b->str); } -int +static int compare_key (const void *a, const void *b) { const Line *line_a = a; @@ -38,6 +39,18 @@ int main (int argc, char **argv) guint i; gboolean do_key = FALSE; gboolean do_file = FALSE; + gchar *locale; + + /* FIXME: need to modify environment here, + * since g_utf8_collate_key calls setlocal (LC_COLLATE, "") + */ + g_setenv ("LC_ALL", "en_US", TRUE); + locale = setlocale (LC_ALL, ""); + if (locale == NULL || strcmp (locale, "en_US") != 0) + { + fprintf (stderr, "No suitable locale, skipping test\n"); + return 2; + } if (argc != 1 && argc != 2 && argc != 3) {