diff options
author | Sébastien Helleu <flashcode@flashtux.org> | 2023-12-02 11:47:45 +0100 |
---|---|---|
committer | Sébastien Helleu <flashcode@flashtux.org> | 2023-12-02 11:47:45 +0100 |
commit | ba33e1db7d56d52046e5b5b3a4dd68ba32fee478 (patch) | |
tree | bb925bf50c0035245aa260acfc108bd2d776dacb /tests/unit | |
parent | d6796edac0033bbbaae68ff85f99bc6d4857a37a (diff) | |
download | weechat-ba33e1db7d56d52046e5b5b3a4dd68ba32fee478.zip |
tests: fix tests on function plugin_api_infolist_plugin_cb
Diffstat (limited to 'tests/unit')
-rw-r--r-- | tests/unit/plugins/test-plugins-api-info.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/tests/unit/plugins/test-plugins-api-info.cpp b/tests/unit/plugins/test-plugins-api-info.cpp index 3a3cba78f..b092869d9 100644 --- a/tests/unit/plugins/test-plugins-api-info.cpp +++ b/tests/unit/plugins/test-plugins-api-info.cpp @@ -1165,6 +1165,8 @@ TEST(PluginsApiInfo, PluginApiInfolistPluginCb) { struct t_infolist *infolist; struct t_weechat_plugin *ptr_plugin; + const char *ptr_name; + char *name; /* invalid plugin pointer */ infolist = hook_infolist_get (NULL, "plugin", (void *)0x1, NULL); @@ -1174,7 +1176,10 @@ TEST(PluginsApiInfo, PluginApiInfolistPluginCb) CHECK(infolist); CHECK(infolist_next (infolist)); ptr_plugin = (struct t_weechat_plugin *)infolist_pointer (infolist, "pointer"); - STRCMP_EQUAL("charset", infolist_string (infolist, "name")); + CHECK(infolist_integer (infolist, "priority") > 0); + ptr_name = infolist_string (infolist, "name"); + CHECK(ptr_name); + name = strdup (ptr_name); CHECK(infolist_next (infolist)); infolist_free (infolist); @@ -1182,7 +1187,7 @@ TEST(PluginsApiInfo, PluginApiInfolistPluginCb) infolist = hook_infolist_get (NULL, "plugin", ptr_plugin, NULL); CHECK(infolist); CHECK(infolist_next (infolist)); - STRCMP_EQUAL("charset", infolist_string (infolist, "name")); + STRCMP_EQUAL(name, infolist_string (infolist, "name")); POINTERS_EQUAL(NULL, infolist_next (infolist)); infolist_free (infolist); @@ -1193,6 +1198,8 @@ TEST(PluginsApiInfo, PluginApiInfolistPluginCb) STRCMP_EQUAL("spell", infolist_string (infolist, "name")); POINTERS_EQUAL(NULL, infolist_next (infolist)); infolist_free (infolist); + + free (name); } /* |