aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorXavier Claessens <xclaesse@gmail.com>2009-11-24 22:54:21 +0800
committerXavier Claessens <xclaesse@gmail.com>2009-11-25 01:29:45 +0800
commit9c1e21c7ad3ba913ebf144b498aa2de6d22a7797 (patch)
tree6ac07a5634e6ca93cf9b7ea0edbe0a9e9cc9bb0a /tests
parentebaadd93adf03514e9e629b6ae7b065803b046e7 (diff)
downloadgsoc2013-empathy-9c1e21c7ad3ba913ebf144b498aa2de6d22a7797.tar
gsoc2013-empathy-9c1e21c7ad3ba913ebf144b498aa2de6d22a7797.tar.gz
gsoc2013-empathy-9c1e21c7ad3ba913ebf144b498aa2de6d22a7797.tar.bz2
gsoc2013-empathy-9c1e21c7ad3ba913ebf144b498aa2de6d22a7797.tar.lz
gsoc2013-empathy-9c1e21c7ad3ba913ebf144b498aa2de6d22a7797.tar.xz
gsoc2013-empathy-9c1e21c7ad3ba913ebf144b498aa2de6d22a7797.tar.zst
gsoc2013-empathy-9c1e21c7ad3ba913ebf144b498aa2de6d22a7797.zip
Replace GString param with a generic gpointer user_data, and port EmpathyChatTextView to new parser API.
Diffstat (limited to 'tests')
-rw-r--r--tests/empathy-parser-test.c26
1 files changed, 21 insertions, 5 deletions
diff --git a/tests/empathy-parser-test.c b/tests/empathy-parser-test.c
index dce91c722..30a28c58a 100644
--- a/tests/empathy-parser-test.c
+++ b/tests/empathy-parser-test.c
@@ -10,28 +10,43 @@
#include <libempathy-gtk/empathy-ui-utils.h>
static void
-test_replace_link (GString *string,
- const gchar *text,
+test_replace_link (const gchar *text,
gssize len,
+ gpointer match_data,
gpointer user_data)
{
+ GString *string = user_data;
+
g_string_append_c (string, '[');
g_string_append_len (string, text, len);
g_string_append_c (string, ']');
}
static void
-test_replace_smiley (GString *string,
- const gchar *text,
+test_replace_smiley (const gchar *text,
gssize len,
+ gpointer match_data,
gpointer user_data)
{
+ GString *string = user_data;
+
g_string_append_c (string, '<');
g_string_append_len (string, text, len);
g_string_append_c (string, '>');
}
static void
+test_replace_verbatim (const gchar *text,
+ gssize len,
+ gpointer match_data,
+ gpointer user_data)
+{
+ GString *string = user_data;
+
+ g_string_append_len (string, text, len);
+}
+
+static void
test_parsers (void)
{
guint i;
@@ -45,6 +60,7 @@ test_parsers (void)
{
{empathy_string_match_link, test_replace_link},
{empathy_string_match_smiley, test_replace_smiley},
+ {empathy_string_match_all, test_replace_verbatim},
{NULL, NULL}
};
@@ -54,7 +70,7 @@ test_parsers (void)
GString *string;
string = g_string_new (NULL);
- empathy_string_parser_substr (string, tests[i], -1, parsers);
+ empathy_string_parser_substr (tests[i], -1, parsers, string);
DEBUG ("'%s' => '%s'", tests[i], string->str);
g_assert_cmpstr (tests[i + 1], ==, string->str);