mirror of
https://git.jabber.space/devs/cproof.git
synced 2026-07-21 21:26:22 +00:00
Free plugins commands on quit
This commit is contained in:
32
tests/unittests/test_callbacks.c
Normal file
32
tests/unittests/test_callbacks.c
Normal file
@@ -0,0 +1,32 @@
|
||||
#include <stdarg.h>
|
||||
#include <stddef.h>
|
||||
#include <setjmp.h>
|
||||
#include <cmocka.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <glib.h>
|
||||
|
||||
#include "plugins/callbacks.h"
|
||||
#include "plugins/plugins.h"
|
||||
|
||||
void returns_no_commands(void **state)
|
||||
{
|
||||
callbacks_init();
|
||||
GList *commands = plugins_get_command_names();
|
||||
|
||||
assert_true(commands == NULL);
|
||||
}
|
||||
|
||||
void returns_commands(void **state)
|
||||
{
|
||||
callbacks_init();
|
||||
PluginCommand *command = malloc(sizeof(PluginCommand));
|
||||
command->command_name = strdup("something");
|
||||
callbacks_add_command("Cool plugin", command);
|
||||
|
||||
GList *commands = plugins_get_command_names();
|
||||
assert_true(g_list_length(commands) == 1);
|
||||
|
||||
char *name = commands->data;
|
||||
assert_string_equal(name, "something");
|
||||
}
|
||||
2
tests/unittests/test_callbacks.h
Normal file
2
tests/unittests/test_callbacks.h
Normal file
@@ -0,0 +1,2 @@
|
||||
void returns_no_commands(void **state);
|
||||
void returns_commands(void **state);
|
||||
@@ -265,7 +265,7 @@ void mucconfwin_show_form(ProfMucConfWin *confwin) {}
|
||||
void mucconfwin_show_form_field(ProfMucConfWin *confwin, DataForm *form, char *tag) {}
|
||||
void mucconfwin_form_help(ProfMucConfWin *confwin) {}
|
||||
void mucconfwin_field_help(ProfMucConfWin *confwin, char *tag) {}
|
||||
void ui_show_lines(ProfWin *window, const gchar** lines) {}
|
||||
void ui_show_lines(ProfWin *window, gchar** lines) {}
|
||||
void ui_redraw_all_room_rosters(void) {}
|
||||
void ui_show_all_room_rosters(void) {}
|
||||
void ui_hide_all_room_rosters(void) {}
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
#include "test_cmd_roster.h"
|
||||
#include "test_cmd_disconnect.h"
|
||||
#include "test_form.h"
|
||||
#include "test_callbacks.h"
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
const UnitTest all_tests[] = {
|
||||
@@ -602,6 +603,9 @@ int main(int argc, char* argv[]) {
|
||||
|
||||
unit_test(prof_partial_occurrences_tests),
|
||||
unit_test(prof_whole_occurrences_tests),
|
||||
|
||||
unit_test(returns_no_commands),
|
||||
unit_test(returns_commands),
|
||||
};
|
||||
|
||||
return run_tests(all_tests);
|
||||
|
||||
Reference in New Issue
Block a user