pidgin/pidgin

Merged in default (pull request #639)

15 months ago, Gary Kramlich
8fe562cc7163
Merged in default (pull request #639)

Re-write jabber util tests to be subtest-ish

Approved-by: Gary Kramlich
Approved-by: John Bailey
--- a/libpurple/protocols/jabber/tests/test_jabber_jutil.c Tue Nov 12 02:40:44 2019 +0000
+++ b/libpurple/protocols/jabber/tests/test_jabber_jutil.c Tue Nov 12 02:54:53 2019 +0000
@@ -7,41 +7,41 @@
#include "xmlnode.h"
#include "protocols/jabber/jutil.h"
+PurpleTestStringData test_jabber_util_get_resource_exists_data[] = {
+ {"foo@bar/baz", "baz"},
+ {"bar/baz", "baz"},
+ {"foo@bar/baz/bat", "baz/bat"},
+ {"bar/baz/bat", "baz/bat"},
+ {NULL, NULL},
+};
static void
-test_jabber_util_get_resource_exists(void) {
- PurpleTestStringData data[] = {
- { "foo@bar/baz", "baz" },
- { "bar/baz", "baz" },
- { "foo@bar/baz/bat", "baz/bat" },
- { "bar/baz/bat", "baz/bat" },
- { NULL, NULL },
- };
-
- purple_test_string_compare_free(jabber_get_resource, data);
+test_jabber_util_get_resource_exists(const PurpleTestStringData *data)
+{
+ g_assert_cmpstr(data->output, ==, jabber_get_resource(data->input));
}
+PurpleTestStringData test_jabber_util_get_resource_none_data[] = {
+ {"foo@bar", NULL},
+ {"bar", NULL},
+ {NULL, NULL},
+};
static void
-test_jabber_util_get_resource_none(void) {
- PurpleTestStringData data[] = {
- { "foo@bar", NULL },
- { "bar", NULL },
- { NULL, NULL },
- };
-
- purple_test_string_compare_free(jabber_get_resource, data);
+test_jabber_util_get_resource_none(const PurpleTestStringData *data)
+{
+ g_assert_cmpstr(data->output, ==, jabber_get_resource(data->input));
}
+PurpleTestStringData test_jabber_util_get_bare_jid_data[] = {
+ {"foo@bar", "foo@bar"},
+ {"foo@bar/baz", "foo@bar"},
+ {"bar", "bar"},
+ {"bar/baz", "bar"},
+ {NULL, NULL},
+};
static void
-test_jabber_util_get_bare_jid(void) {
- PurpleTestStringData data[] = {
- { "foo@bar", "foo@bar" },
- { "foo@bar/baz", "foo@bar" },
- { "bar", "bar" },
- { "bar/baz", "bar" },
- { NULL, NULL },
- };
-
- purple_test_string_compare_free(jabber_get_bare_jid, data);
+test_jabber_util_get_bare_jid(const PurpleTestStringData *data)
+{
+ g_assert_cmpstr(data->output, ==, jabber_get_bare_jid(data->input));
}
static void
@@ -70,23 +70,21 @@
g_free(longnode);