diff options
author | Xavier Claessens <xclaesse@gmail.com> | 2009-11-25 17:19:21 +0800 |
---|---|---|
committer | Xavier Claessens <xclaesse@gmail.com> | 2009-11-25 17:19:21 +0800 |
commit | fe57de44b370951c5e0a5de0aa78e0bb0fca9849 (patch) | |
tree | 68467b23a02811af673caf6faf927d5984ce6649 | |
parent | 2d9bbb26709398a1211312306ce5bee4b639f2a3 (diff) | |
download | gsoc2013-empathy-fe57de44b370951c5e0a5de0aa78e0bb0fca9849.tar gsoc2013-empathy-fe57de44b370951c5e0a5de0aa78e0bb0fca9849.tar.gz gsoc2013-empathy-fe57de44b370951c5e0a5de0aa78e0bb0fca9849.tar.bz2 gsoc2013-empathy-fe57de44b370951c5e0a5de0aa78e0bb0fca9849.tar.lz gsoc2013-empathy-fe57de44b370951c5e0a5de0aa78e0bb0fca9849.tar.xz gsoc2013-empathy-fe57de44b370951c5e0a5de0aa78e0bb0fca9849.tar.zst gsoc2013-empathy-fe57de44b370951c5e0a5de0aa78e0bb0fca9849.zip |
Add some more tests, and fail only after all have run, it's easier to debug
-rw-r--r-- | tests/empathy-parser-test.c | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/tests/empathy-parser-test.c b/tests/empathy-parser-test.c index 6c549f905..001882863 100644 --- a/tests/empathy-parser-test.c +++ b/tests/empathy-parser-test.c @@ -4,6 +4,8 @@ #include "test-helper.h" +#include <telepathy-glib/util.h> + #define DEBUG_FLAG EMPATHY_DEBUG_TESTS #include <libempathy/empathy-debug.h> @@ -36,17 +38,19 @@ test_replace_verbatim (const gchar *text, static void test_parsers (void) { - guint i; gchar *tests[] = { /* Basic link matches */ "http://foo.com", "[http://foo.com]", + "http://foo.com\nhttp://bar.com", "[http://foo.com]\n[http://bar.com]", + "http://foo.com/test?id=bar?", "[http://foo.com/test?id=bar]?", "git://foo.com", "[git://foo.com]", "git+ssh://foo.com", "[git+ssh://foo.com]", "mailto:user@server.com", "[mailto:user@server.com]", "www.foo.com", "[www.foo.com]", "ftp.foo.com", "[ftp.foo.com]", "user@server.com", "[user@server.com]", + "first.last@server.com", "[first.last@server.com]", "http://foo.com. bar", "[http://foo.com]. bar", "http://foo.com; bar", "[http://foo.com]; bar", "http://foo.com: bar", "[http://foo.com]: bar", @@ -70,11 +74,10 @@ test_parsers (void) "Foo \"www.foo.com\"", "Foo \"[www.foo.com]\"", "Foo (www.foo.com/bar(123)baz)", "Foo ([www.foo.com/bar(123)baz])", "<a href=\"http://foo.com\">bar</a>", "<a href=\"[http://foo.com]\">bar</a>", - /* FIXME; Known issue: With email addresses, any leading character is matched */ - //"Foo (user@server.com)", "Foo ([user@server.com])", - //"Foo {user@server.com}", "Foo {[user@server.com]}", - //"Foo [user@server.com]", "Foo [[user@server.com]]", - //"Foo <user@server.com>", "Foo <[user@server.com]>", + "Foo (user@server.com)", "Foo ([user@server.com])", + "Foo {user@server.com}", "Foo {[user@server.com]}", + "Foo [user@server.com]", "Foo [[user@server.com]]", + "Foo <user@server.com>", "Foo <[user@server.com]>", "Foo \"user@server.com\"", "Foo \"[user@server.com]\"", /* Basic smileys */ @@ -102,20 +105,27 @@ test_parsers (void) {empathy_string_match_all, test_replace_verbatim}, {NULL, NULL} }; + guint i; + gboolean failed = FALSE; DEBUG ("Started"); for (i = 0; tests[i] != NULL; i += 2) { GString *string; + gboolean ok; string = g_string_new (NULL); empathy_string_parser_substr (tests[i], -1, parsers, string); - DEBUG ("'%s' => '%s'", tests[i], string->str); - g_assert_cmpstr (tests[i + 1], ==, string->str); + ok = !tp_strdiff (tests[i + 1], string->str); + DEBUG ("'%s' => '%s': %s", tests[i], string->str, ok ? "OK" : "FAILED"); + if (!ok) + failed = TRUE; g_string_free (string, TRUE); } + + g_assert (!failed); } int |