mirror of
https://git.jabber.space/devs/cproof.git
synced 2026-07-26 00:56:22 +00:00
Moved all tests to tests folder
This commit is contained in:
45
tests/unittests/test_cmd_sub.c
Normal file
45
tests/unittests/test_cmd_sub.c
Normal file
@@ -0,0 +1,45 @@
|
||||
#include <stdarg.h>
|
||||
#include <stddef.h>
|
||||
#include <setjmp.h>
|
||||
#include <cmocka.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <glib.h>
|
||||
|
||||
#include "xmpp/xmpp.h"
|
||||
|
||||
#include "ui/ui.h"
|
||||
#include "ui/stub_ui.h"
|
||||
|
||||
#include "command/commands.h"
|
||||
|
||||
void cmd_sub_shows_message_when_not_connected(void **state)
|
||||
{
|
||||
CommandHelp *help = malloc(sizeof(CommandHelp));
|
||||
gchar *args[] = { NULL };
|
||||
|
||||
will_return(jabber_get_connection_status, JABBER_DISCONNECTED);
|
||||
|
||||
expect_cons_show("You are currently not connected.");
|
||||
|
||||
gboolean result = cmd_sub(args, *help);
|
||||
assert_true(result);
|
||||
|
||||
free(help);
|
||||
}
|
||||
|
||||
void cmd_sub_shows_usage_when_no_arg(void **state)
|
||||
{
|
||||
CommandHelp *help = malloc(sizeof(CommandHelp));
|
||||
help->usage = "Some usage";
|
||||
gchar *args[] = { NULL };
|
||||
|
||||
will_return(jabber_get_connection_status, JABBER_CONNECTED);
|
||||
|
||||
expect_cons_show("Usage: Some usage");
|
||||
|
||||
gboolean result = cmd_sub(args, *help);
|
||||
assert_true(result);
|
||||
|
||||
free(help);
|
||||
}
|
||||
Reference in New Issue
Block a user