mirror of
https://git.jabber.space/devs/cproof.git
synced 2026-07-22 14:36:21 +00:00
Added test for /bookmark list
This commit is contained in:
@@ -26,6 +26,9 @@
|
||||
#include <string.h>
|
||||
|
||||
#include "ui/ui.h"
|
||||
#include "tests/helpers.h"
|
||||
|
||||
#include "xmpp/bookmark.h"
|
||||
|
||||
char output[256];
|
||||
|
||||
@@ -70,6 +73,12 @@ void _mock_cons_show_account(ProfAccount *account)
|
||||
check_expected(account);
|
||||
}
|
||||
|
||||
static
|
||||
void _mock_cons_show_bookmarks(const GList *list)
|
||||
{
|
||||
check_expected(list);
|
||||
}
|
||||
|
||||
static
|
||||
void _mock_cons_show_aliases(GList *aliases)
|
||||
{
|
||||
@@ -165,6 +174,12 @@ mock_cons_show_account(void)
|
||||
cons_show_account = _mock_cons_show_account;
|
||||
}
|
||||
|
||||
void
|
||||
mock_cons_show_bookmarks(void)
|
||||
{
|
||||
cons_show_bookmarks = _mock_cons_show_bookmarks;
|
||||
}
|
||||
|
||||
void
|
||||
mock_cons_show_aliases(void)
|
||||
{
|
||||
@@ -233,6 +248,30 @@ expect_cons_show_account(ProfAccount *account)
|
||||
expect_memory(_mock_cons_show_account, account, account, sizeof(ProfAccount));
|
||||
}
|
||||
|
||||
static gboolean
|
||||
_cmp_bookmark(Bookmark *bm1, Bookmark *bm2)
|
||||
{
|
||||
if (strcmp(bm1->jid, bm2->jid) != 0) {
|
||||
return FALSE;
|
||||
}
|
||||
if (strcmp(bm1->nick, bm2->nick) != 0) {
|
||||
return FALSE;
|
||||
}
|
||||
if (bm1->autojoin != bm2->autojoin) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
expect_cons_show_bookmarks(GList *bookmarks)
|
||||
{
|
||||
glist_set_cmp((GCompareFunc)_cmp_bookmark);
|
||||
expect_any(_mock_cons_show_bookmarks, list);
|
||||
// expect_check(_mock_cons_show_bookmarks, list, (CheckParameterValue)glist_contents_equal, bookmarks);
|
||||
}
|
||||
|
||||
void
|
||||
expect_cons_show_account_list(gchar **accounts)
|
||||
{
|
||||
|
||||
@@ -5,6 +5,9 @@
|
||||
#include <setjmp.h>
|
||||
#include <cmocka.h>
|
||||
|
||||
#include "config/account.h"
|
||||
#include "contact.h"
|
||||
|
||||
void stub_cons_show(void);
|
||||
|
||||
void mock_cons_show(void);
|
||||
@@ -27,6 +30,9 @@ void expect_ui_handle_recipient_not_found(char *recipient, char *err_msg);
|
||||
void mock_cons_show_account(void);
|
||||
void expect_cons_show_account(ProfAccount *account);
|
||||
|
||||
void mock_cons_show_bookmarks(void);
|
||||
void expect_cons_show_bookmarks(GList *bookmarks);
|
||||
|
||||
void mock_cons_show_aliases(void);
|
||||
void expect_cons_show_aliases(void);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user