Remove spacing in headers view calendar, as it was causing a very bad
[modest] / tests / check_text-utils.c
index 76013b6..cf48b95 100644 (file)
 #include <check.h>
 #include <stdlib.h>
 #include <string.h>
+#include <stdlib.h>
 #include <modest-text-utils.h>
+#include <modest-init.h>
 
 typedef struct {
        const gchar *original;
        const gchar *expected;
 } StringPair;
 
+static void
+fx_setup_i18n ()
+{
+       fail_unless (gtk_init_check (NULL, NULL));
+       fail_unless (modest_init (0, NULL), "Failed running modest_init");
+}
+
 /* ----------------- display address tests -------------- */
 
 /**
@@ -47,12 +56,12 @@ typedef struct {
  *  - Test 4: Check issues in tests 1, 2 and 3 together
  *  - Test 5: Check with an empty address
  */
-START_TEST (test_display_address_regular)
+START_TEST (test_get_display_address_regular)
 {
        gint i;
        const StringPair tests[] = {
                { "John Doe <foo@bar>", "John Doe" },
-               { "Rupert Griffin (test)", "Rupert Griffin"},
+               { "Rupert Griffin (test)", "Rupert Griffin (test)"},
                { "    Hyvää päivää    ", "Hyvää päivää"},
                { "  John Doe  <foo@bar>  (test)  ", "John Doe" },
                { "", "" },
@@ -61,7 +70,7 @@ START_TEST (test_display_address_regular)
        /* Tests 1, 2, 3, 4 */
        for (i = 0; i !=  sizeof(tests)/sizeof(StringPair); ++i) {
                gchar *str = g_strdup (tests[i].original);
-               str = modest_text_utils_get_display_address (str);
+               modest_text_utils_get_display_address (str);
                fail_unless (str && strcmp(str, tests[i].expected) == 0,
                        "modest_text_utils_get_display_address failed for '%s': "
                             "expected '%s' but got '%s'",
@@ -76,11 +85,10 @@ END_TEST
  * Test invalid usage of modest_text_utils_get_display_address
  *  - Test 1: Check with NULL address (should return NULL)
  */
-START_TEST (test_display_address_invalid)
+START_TEST (test_get_display_address_invalid)
 {
        /* Test 1 */
-       fail_unless (modest_text_utils_get_display_address (NULL) == NULL,
-                    "modest_text_utils_get_display_address(NULL) should be NULL");
+       modest_text_utils_get_display_address (NULL);
 }
 END_TEST
 
@@ -99,9 +107,9 @@ START_TEST (test_derived_subject_regular)
        const gchar *prefix="Re:";
        const StringPair tests[] = {
                { "subject", "Re: subject" },
-               { NULL,      "Re:"},
+               { NULL,      "Re: (no subject)"},
                { "Hyvää päivää", "Re: Hyvää päivää"},
-               { "", "Re: "},
+               { "", "Re: (no subject)"},
        };
 
        /* Tests 1, 2, 3, 4 */
@@ -151,20 +159,21 @@ START_TEST (test_quote_regular)
        /* Tests 1, 2, 3 */
        const StringPair tests[] = {
                { "", 
-                 "On Thu Jan  1 01:00:00 1970, foo@bar wrote:\n> \n" },
+                 "\n----- Original message -----\n> \n" },
                { "This text should be quoted", 
-                 "On Thu Jan  1 01:00:00 1970, foo@bar wrote:\n> This text\n> should be quoted\n> \n" },
+                 "\n----- Original message -----\n> This text\n> should be quoted\n> \n" },
                { "These are several\nlines\nof plain text", 
-                 "On Thu Jan  1 01:00:00 1970, foo@bar wrote:\n> These are\n> several lines\n> of plain text\n" },
+                 "\n----- Original message -----\n> These are\n> several lines\n> of plain text\n" },
                { "áéíÍÓÚäëïÏÖÜñÑçÇŽÊîš", 
-                 "On Thu Jan  1 01:00:00 1970, foo@bar wrote:\n> áéíÍÓÚäëïÏÖÜñÑçÇŽÊîš\n" },
+                 "\n----- Original message -----\n> áéíÍÓÚäëïÏÖÜñÑçÇŽÊîš\n" },
        };
 
        for (i = 0; i !=  sizeof(tests)/sizeof(StringPair); ++i) {
                text = g_strdup (tests[i].original);
                expected_quoted_text = g_strdup (tests[i].expected);
-               quoted_text = modest_text_utils_quote (text, "text/plain", "foo@bar",  0, 15);
-               fail_unless (quoted_text && !strcmp (expected_quoted_text, quoted_text),
+               quoted_text = modest_text_utils_quote (text, "text/plain", NULL /*signature*/,
+                                                      "foo@bar",  0 /* date */, NULL /*attachments*/, 15 /*limit*/);
+               fail_unless (quoted_text && strcmp(expected_quoted_text, quoted_text)==0,
                             "modest_text_utils_quote failed:\nOriginal text:\n\"%s\"\n" \
                             "Expected quotation:\n\"%s\"\nQuoted text:\n\"%s\"",
                             text, expected_quoted_text, quoted_text);
@@ -176,8 +185,9 @@ START_TEST (test_quote_regular)
        /* Test 5 */
        text = g_strdup ("Quotation test example");
        expected_quoted_text = 
-               g_strdup ("On Thu Jan  1 01:00:00 1970, foo@bar wrote:\n> Quotation\n> test\n> example\n> \n");
-       quoted_text = modest_text_utils_quote (text, "text/plain", "foo@bar",  0, 1);
+               g_strdup ("\n----- Original message -----\n> Quotation\n> test\n> example\n> \n");
+       quoted_text = modest_text_utils_quote (text, "text/plain", NULL /*signature */,
+                                              "foo@bar",  0 /*date*/, NULL /*attachments*/, 1 /*limit*/);
        fail_unless (quoted_text && !strcmp (expected_quoted_text, quoted_text),
                     "modest_text_utils_quote failed:\nOriginal text:\n\"%s\"\n" \
                     "Expected quotation:\n\"%s\"\nQuoted text:\n\"%s\"",
@@ -204,7 +214,7 @@ START_TEST (test_quote_invalid)
 
        /* Test 1 (Fault) */
        text = NULL;
-       quoted_text = modest_text_utils_quote (NULL, "text/plain", "foo@bar",  0, 15);
+       quoted_text = modest_text_utils_quote (NULL, "text/plain", NULL, "foo@bar",  0, NULL, 15);
        fail_unless (quoted_text == NULL,
                     "modest_text_utils_quote failed:\nOriginal text: NULL\n" \
                     "Expected quotation: NULL\nQuoted text: \"%s\"",
@@ -214,32 +224,30 @@ START_TEST (test_quote_invalid)
        
        /* Test 2 (Fault) */
        text = g_strdup ("Text");
-       expected_quoted_text = g_strdup ("On Thu Jan  1 01:00:00 1970, foo@bar wrote:\n> Text\n");
-       quoted_text = modest_text_utils_quote (text, NULL, "foo@bar",  0, 15);
+       quoted_text = modest_text_utils_quote (text, NULL, NULL, "foo@bar",  0, NULL, 15);
        fail_unless (quoted_text == NULL,
                     "modest_text_utils_quote failed:\nOriginal text: NULL\n" \
                     "Expected quotation: NULL\nQuoted text: \"%s\"",
                     quoted_text);
        g_free (text);
-       g_free (expected_quoted_text);
        g_free (quoted_text);
 
        /* Test 3 */
        text = g_strdup ("Text");
-       expected_quoted_text = g_strdup ("On Thu Jan  1 01:00:00 1970, (null) wrote:\n> Text\n");
-       quoted_text = modest_text_utils_quote (text, "text/plain", NULL,  0, 15);
-       fail_unless (quoted_text == NULL,
+       expected_quoted_text = g_strdup ("\n----- Original message -----\n> Text\n");
+       quoted_text = modest_text_utils_quote (text, "text/plain", NULL, NULL,  0, NULL, 15);
+       fail_unless (quoted_text && strcmp (quoted_text, expected_quoted_text) == 0,
                     "modest_text_utils_quote failed:\nOriginal text: NULL\n" \
-                    "Expected quotation: NULL\nQuoted text: \"%s\"",
-                    quoted_text);
+                    "Expected quotation: %s\nQuoted text: \"%s\"",
+                    expected_quoted_text, quoted_text);
        g_free (text);
        g_free (expected_quoted_text);
        g_free (quoted_text);
 
        /* Test 4 */
        text = g_strdup ("This is a text");
-       expected_quoted_text = g_strdup ("On Thu Jan  1 01:00:00 1970, foo@bar wrote:\n> This\n> is\n> a\n> text\n> \n");
-       quoted_text = modest_text_utils_quote (text, "text/plain", "foo@bar",  0, 0);
+       expected_quoted_text = g_strdup ("\n----- Original message -----\n> This\n> is\n> a\n> text\n> \n");
+       quoted_text = modest_text_utils_quote (text, "text/plain", NULL, "foo@bar",  0, NULL, 0);
        fail_unless (quoted_text && !strcmp (expected_quoted_text, quoted_text),
                     "modest_text_utils_quote failed:\nOriginal text:\n\"%s\"\n" \
                     "Expected quotation:\n\"%s\"\nQuoted text:\n\"%s\"",
@@ -265,18 +273,18 @@ START_TEST (test_cite_regular)
        gchar *cited_text = NULL;
        const StringPair tests[] = {
                { "", 
-                 "On Thu Jan  1 01:00:00 1970, foo@bar wrote:\n\n" },
+                 "\n--\nSIGNATURE" },
                { "This is some text", 
-                 "On Thu Jan  1 01:00:00 1970, foo@bar wrote:\nThis is some text\n" },
+                 "This is some text\n--\nSIGNATURE" },
                { "This\nis some\ntext", 
-                 "On Thu Jan  1 01:00:00 1970, foo@bar wrote:\nThis\nis some\ntext\n" },
+                 "This\nis some\ntext\n--\nSIGNATURE" },
                { "áéíÍÓÚäëïÏÖÜñÑçÇŽÊîš",
-                 "On Thu Jan  1 01:00:00 1970, foo@bar wrote:\náéíÍÓÚäëïÏÖÜñÑçÇŽÊîš\n" },
+                 "áéíÍÓÚäëïÏÖÜñÑçÇŽÊîš\n--\nSIGNATURE" },
        };
 
        /* Tests 1, 2, 3, 4 */
        for (i = 0; i !=  sizeof(tests)/sizeof(StringPair); ++i) {
-               cited_text = modest_text_utils_cite (tests[i].original, "text/plain", "foo@bar", 0);
+               cited_text = modest_text_utils_cite (tests[i].original, "text/plain", "SIGNATURE", "foo@bar", 0);
                fail_unless (cited_text && !strcmp (tests[i].expected, cited_text),
                             "modest_text_utils_cite failed:\nOriginal text:\n\"%s\"\n" \
                             "Expected cite:\n\"%s\"\nCite obtained:\n\"%s\"",
@@ -300,19 +308,30 @@ START_TEST (test_cite_invalid)
 
        /* Test 1 */
        text = NULL;
-       expected_cite = g_strdup ("On Thu Jan  1 01:00:00 1970, foo@bar wrote:\n(null)\n");
-       cited_text = modest_text_utils_cite (text, "text/plain", "foo@bar", 0);
-       fail_unless (cited_text && !strcmp (expected_cite, cited_text),
+       cited_text = modest_text_utils_cite (text, "text/plain", "SIGNATURE", "foo@bar", 0);
+       fail_unless (cited_text == NULL,
                     "modest_text_utils_cite failed:\nOriginal text:\nNULL\n" \
-                    "Expected cite:\n\"%s\"\nCite obtained:\n\"%s\"",
-                    expected_cite, cited_text);
+                    "Expected cite:\nNULL\nCite obtained:\n\"%s\"",
+                    cited_text);
        g_free (expected_cite);
        g_free (cited_text);
 
        /* Test 2 */
        text = g_strdup ("This is some text");
-       expected_cite = g_strdup ("On Thu Jan  1 01:00:00 1970, (null) wrote:\nThis is some text\n");
-       cited_text = modest_text_utils_cite (text, "text/plain", NULL, 0);
+       expected_cite = g_strdup ("This is some text\n--\nSIGNATURE");
+       cited_text = modest_text_utils_cite (text, "text/plain", "SIGNATURE", NULL, 0);
+       fail_unless (cited_text && !strcmp (expected_cite, cited_text),
+                    "modest_text_utils_cite failed:\nOriginal text:\n\"%s\"\n" \
+                    "Expected cite:\n\"%s\"\nCite obtained:\n\"%s\"",
+                    text, expected_cite, cited_text);
+       g_free (text);
+       g_free (expected_cite);
+       g_free (cited_text);
+
+       /* Test 3 */
+       text = g_strdup ("This is some text");
+       expected_cite = g_strdup ("This is some text");
+       cited_text = modest_text_utils_cite (text, "text/plain", NULL, "foo@bar", 0);
        fail_unless (cited_text && !strcmp (expected_cite, cited_text),
                     "modest_text_utils_cite failed:\nOriginal text:\n\"%s\"\n" \
                     "Expected cite:\n\"%s\"\nCite obtained:\n\"%s\"",
@@ -338,31 +357,32 @@ START_TEST (test_inline_regular)
        gchar *inlined_text = NULL;
        const StringPair tests[] = {
                { "", 
-                 "-----Forwarded Message-----\n" \
+                 "\n----- Original message -----\n" \
                  "From: foo@bar\n" \
-                 "Sent: Thu Jan  1 01:00:00 1970\n" \
+                 "Sent:  Thu,  1 Jan 1970, 01:00:00 CET\n" \
                  "To: bar@foo\n" \
-                 "Subject: Any subject\n\n" },
+                 "Subject: Any subject\n\n> \n" },
                { "Some text\nto inline", 
-                 "-----Forwarded Message-----\n" \
+                 "\n----- Original message -----\n" \
                  "From: foo@bar\n" \
-                 "Sent: Thu Jan  1 01:00:00 1970\n" \
+                 "Sent:  Thu,  1 Jan 1970, 01:00:00 CET\n" \
                  "To: bar@foo\n" \
                  "Subject: Any subject\n\n" \
-                 "Some text\nto inline" },
+                 "> Some text\n> to inline\n" },
                { "áéíÍÓÚäëïÏÖÜñÑçÇŽÊîš", 
-                 "-----Forwarded Message-----\n" \
+                 "\n----- Original message -----\n" \
                  "From: foo@bar\n" \
-                 "Sent: Thu Jan  1 01:00:00 1970\n" \
+                 "Sent:  Thu,  1 Jan 1970, 01:00:00 CET\n" \
                  "To: bar@foo\n" \
                  "Subject: Any subject\n\n" \
-                 "áéíÍÓÚäëïÏÖÜñÑçÇŽÊîš" },
+                 "> áéíÍÓÚäëïÏÖÜñÑçÇŽÊîš\n" },
        };
 
        /* Tests 1, 2, 3 */
        for (i = 0; i !=  sizeof(tests)/sizeof(StringPair); ++i) {
                inlined_text =  modest_text_utils_inline (tests[i].original, 
                                                          "text/plain", 
+                                                         NULL, 
                                                          "foo@bar", 
                                                          0, 
                                                          "bar@foo", 
@@ -400,12 +420,14 @@ START_TEST (test_inline_invalid)
                                   "(null)");
        inlined_text =  modest_text_utils_inline (NULL, 
                                                  "text/plain", 
+                                                 NULL,
                                                  "foo@bar", 
                                                  0, 
                                                  "bar@foo", 
                                                  "Any subject");
        fail_unless (inlined_text == NULL, 
                     "modest_text_utils_inline failed: it should return NULL");
+       g_free (expected_inline);
        g_free (inlined_text);
 
        /* Test 2 (Fault) */
@@ -418,68 +440,79 @@ START_TEST (test_inline_invalid)
                                   "Some text");
        inlined_text =  modest_text_utils_inline (text,
                                                  NULL,
+                                                 NULL,
                                                  "foo@bar",
                                                  0,
                                                  "bar@foo",
                                                  "Any subject");
        fail_unless (inlined_text == NULL, 
                     "modest_text_utils_inline failed: it should return NULL");
+       g_free (expected_inline);
        g_free (inlined_text);
 
        /* Test 3 */
        text = g_strdup ("Some text");
-       expected_inline = g_strdup("-----Forwarded Message-----\n" \
-                                  "From: (null)\n" \
-                                  "Sent: Thu Jan  1 01:00:00 1970\n" \
+       expected_inline = g_strdup("\n----- Original message -----\n"   \
+                                  "From: \n" \
+                                  "Sent:  Thu,  1 Jan 1970, 01:00:00 CET\n" \
                                   "To: bar@foo\n" \
                                   "Subject: Any subject\n\n" \
-                                  "Some text");
+                                  "> Some text\n");
        inlined_text =  modest_text_utils_inline (text, 
                                                  "text/plain", 
                                                  NULL, 
+                                                 NULL, 
                                                  0, 
                                                  "bar@foo", 
                                                  "Any subject");
-       fail_unless (inlined_text == NULL, 
-                    "modest_text_utils_inline failed: it should return NULL");
+       fail_unless (inlined_text && strcmp (inlined_text, expected_inline) == 0, 
+                    "modest_text_utils_inline failed: it should return %s and returned %s",
+                    expected_inline, inlined_text);
 
+       g_free (expected_inline);
        g_free (inlined_text);
 
        /* Test 4 */
        text = g_strdup ("Some text");
-       expected_inline = g_strdup("-----Forwarded Message-----\n" \
+       expected_inline = g_strdup("\n----- Original message -----\n"   \
                                   "From: foo@bar\n" \
-                                  "Sent: Thu Jan  1 01:00:00 1970\n" \
-                                  "To: (null)\n" \
+                                  "Sent:  Thu,  1 Jan 1970, 01:00:00 CET\n" \
+                                  "To: \n" \
                                   "Subject: Any subject\n\n" \
-                                  "Some text");
+                                  "> Some text\n");
        inlined_text =  modest_text_utils_inline (text, 
                                                  "text/plain", 
+                                                 NULL,
                                                  "foo@bar", 
                                                  0, 
                                                  NULL, 
                                                  "Any subject");
-       fail_unless (inlined_text == NULL, 
-                    "modest_text_utils_inline failed: it should return NULL");
+       fail_unless (inlined_text && strcmp (inlined_text, expected_inline) == 0, 
+                    "modest_text_utils_inline failed: it should return %s and returned %s",
+                    expected_inline, inlined_text);
+       g_free (expected_inline);
        g_free (inlined_text);
        
        /* Test 5 */
        text = g_strdup ("Some text");
-       expected_inline = g_strdup("-----Forwarded Message-----\n" \
+       expected_inline = g_strdup("\n----- Original message -----\n" \
                                   "From: foo@bar\n" \
-                                  "Sent: Thu Jan  1 01:00:00 1970\n" \
+                                  "Sent:  Thu,  1 Jan 1970, 01:00:00 CET\n" \
                                   "To: bar@foo\n" \
-                                  "Subject: (null)\n\n" \
-                                  "Some text");
+                                  "Subject: \n\n" \
+                                  "> Some text\n");
        inlined_text =  modest_text_utils_inline (text, 
                                                  "text/plain", 
+                                                 NULL, 
                                                  "foo@bar", 
                                                  0, 
                                                  "bar@foo", 
                                                  NULL);
-       fail_unless (inlined_text == NULL, 
-                    "modest_text_utils_inline failed: it should return NULL");
+       fail_unless (inlined_text && strcmp (inlined_text, expected_inline) == 0, 
+                    "modest_text_utils_inline failed: it should return %s and returned %s",
+                    expected_inline, inlined_text);
 
+       g_free (expected_inline);
        g_free (inlined_text);
 }
 END_TEST
@@ -636,7 +669,7 @@ START_TEST (test_remove_address_limits)
        gchar *list = NULL;
        gchar *new_list = NULL;
        gchar *expected_list = NULL;
-       gchar *address = NULL;
+       //gchar *address = NULL;
        gint i;
 
        const StringPair tests[] = {
@@ -706,13 +739,15 @@ START_TEST (test_convert_to_html_regular)
        gchar *html_end = NULL;
        gchar *html = NULL;
        gint bytes;
+       int i;
+
        const StringPair tests[] = {
                { "This is some text.", 
-                 "<tt>This is some text.</tt>" },
+                 "<body>This is some text.</body>" },
                { "http://xxx.yyy.zzz/myfile", 
-                 "<tt><a href=\"http://xxx.yyy.zzz/myfile\">http://xxx.yyy.zzz/myfile</a></tt>" },
+                 "<body><a href=\"http://xxx.yyy.zzz/myfile\">http://xxx.yyy.zzz/myfile</a></body>" },
                { "<a  &  b>\n\tx", 
-                 "<tt>&lt;a &nbsp;&quot;&nbsp;&nbsp;b&gt;<br>\n&nbsp; &nbsp;&nbsp;x</tt>" },
+                 "<body>&lt;a&nbsp; &amp;&nbsp; b&gt;<br>\n&nbsp;&nbsp;&nbsp; x</body>" },
        };
 
        /* Tests 1, 2, 3 */
@@ -722,15 +757,17 @@ START_TEST (test_convert_to_html_regular)
                             "modest_text_utils_convert_to_html failed:" \
                             "Original text:\n\"%s\"\nExpected html:\n\"%s\"\nObtained html:\nNULL",
                             tests[i].original, tests[i].expected);
-               html_start = strstr (html, "<tt>");
+               html_start = strstr (html, "<body>");
                html_end = strstr (html, "</body>");
+               if (html_end != NULL)
+                       html_end += strlen ("</body>");
                bytes = html_end - html_start;
                text_in_html = g_strndup (html_start, bytes);
                
                fail_unless (strstr (html, tests[i].expected) != NULL,
                             "modest_text_utils_convert_to_html failed:" \
-                            "Original text:\n\"%s\"\nExpected html:\n\"%s\"\nObtained html:\n\"%s\"",
-                            tests[i].original, tests[i].expected, text_in_html);
+                            "Original text:\n\"%s\"\nExpected html:\n\"%s\"\n\nObtained string:\n\"%s\"\nObtained html:\n\"%s\"",
+                            tests[i].original, tests[i].expected, html, text_in_html);
 //             g_free (html_start);
 //             g_free (text_in_html);
 //             g_free (html);
@@ -765,36 +802,54 @@ text_utils_suite (void)
 
        /* Tests case for "display adress" */
        tc = tcase_create ("display_adress");
-       tcase_add_test (tc, test_display_address_regular);
-       tcase_add_test (tc, test_display_address_invalid);
+       tcase_add_checked_fixture (tc,
+                                  fx_setup_i18n,
+                                  NULL);
+       tcase_add_test (tc, test_get_display_address_regular);
+       tcase_add_test (tc, test_get_display_address_invalid);
        suite_add_tcase (suite, tc);
 
        /* Test case for "derived subject" */
        tc = tcase_create ("derived_subject");
+       tcase_add_checked_fixture (tc,
+                                  fx_setup_i18n,
+                                  NULL);
         tcase_add_test (tc, test_derived_subject_regular);
        tcase_add_test (tc, test_derived_subject_invalid);
        suite_add_tcase (suite, tc);
 
        /* Test case for "quote" */
        tc = tcase_create ("quote");
+       tcase_add_checked_fixture (tc,
+                                  fx_setup_i18n,
+                                  NULL);
         tcase_add_test (tc, test_quote_regular);
        tcase_add_test (tc, test_quote_invalid);
        suite_add_tcase (suite, tc);
 
        /* Test case for "cite" */
        tc = tcase_create ("cite");
+       tcase_add_checked_fixture (tc,
+                                  fx_setup_i18n,
+                                  NULL);
         tcase_add_test (tc, test_cite_regular);
        tcase_add_test (tc, test_cite_invalid);
        suite_add_tcase (suite, tc);
 
        /* Test case for "inline" */
        tc = tcase_create ("inline");
+       tcase_add_checked_fixture (tc,
+                                  fx_setup_i18n,
+                                  NULL);
         tcase_add_test (tc, test_inline_regular);
        tcase_add_test (tc, test_inline_invalid);
        suite_add_tcase (suite, tc);
 
        /* Test case for "remove address" */
        tc = tcase_create ("remove_address");
+       tcase_add_checked_fixture (tc,
+                                  fx_setup_i18n,
+                                  NULL);
         tcase_add_test (tc, test_remove_address_regular);
         tcase_add_test (tc, test_remove_address_limits);
        tcase_add_test (tc, test_remove_address_invalid);
@@ -802,6 +857,9 @@ text_utils_suite (void)
 
        /* Test case for "convert to html" */
        tc = tcase_create ("convert_to_html");
+       tcase_add_checked_fixture (tc,
+                                  fx_setup_i18n,
+                                  NULL);
         tcase_add_test (tc, test_convert_to_html_regular);
        tcase_add_test (tc, test_convert_to_html_invalid);
        suite_add_tcase (suite, tc);
@@ -819,10 +877,12 @@ main ()
        int     failures;
 
        setenv ("TZ", "Europe/Paris", 1);
+       setenv ("LANG", "en_GB", 1);
+       setenv ("LC_MESSAGES", "en_GB", 1);
        
        suite   = text_utils_suite ();
        srunner = srunner_create (suite);
-       
+               
        srunner_run_all (srunner, CK_ENV);
        failures = srunner_ntests_failed (srunner);
        srunner_free (srunner);