5 #include "test-helper.h"
7 #define DEBUG_FLAG EMPATHY_DEBUG_TESTS
8 #include <libempathy/empathy-debug.h>
10 #include <libempathy-gtk/empathy-ui-utils.h>
13 test_replace_link (GString *string,
18 g_string_append_c (string, '[');
19 g_string_append_len (string, text, len);
20 g_string_append_c (string, ']');
24 test_replace_smiley (GString *string,
29 g_string_append_c (string, '<');
30 g_string_append_len (string, text, len);
31 g_string_append_c (string, '>');
40 "http://foo.com", "[http://foo.com]",
41 ":)http://foo.com :D", "<:)>[http://foo.com] <:D>",
44 EmpathyStringParser parsers[] =
46 {empathy_string_match_link, test_replace_link},
47 {empathy_string_match_smiley, test_replace_smiley},
52 for (i = 0; tests[i] != NULL; i += 2)
56 string = g_string_new (NULL);
57 empathy_string_parser_substr (string, tests[i], -1, parsers);
59 DEBUG ("'%s' => '%s'", tests[i], string->str);
60 g_assert_cmpstr (tests[i + 1], ==, string->str);
62 g_string_free (string, TRUE);
72 test_init (argc, argv);
74 g_test_add_func ("/parsers", test_parsers);
76 result = g_test_run ();