mirror of
https://git.jabber.space/devs/cproof.git
synced 2026-07-26 12:36:21 +00:00
Added cmd_pgp tests
This commit is contained in:
43
tests/unittests/test_cmd_pgp.c
Normal file
43
tests/unittests/test_cmd_pgp.c
Normal file
@@ -0,0 +1,43 @@
|
||||
#include <stdarg.h>
|
||||
#include <stddef.h>
|
||||
#include <setjmp.h>
|
||||
#include <cmocka.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <glib.h>
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "command/commands.h"
|
||||
|
||||
#include "ui/stub_ui.h"
|
||||
|
||||
#ifdef HAVE_LIBGPGME
|
||||
void cmd_pgp_shows_usage_when_no_args(void **state)
|
||||
{
|
||||
CommandHelp *help = malloc(sizeof(CommandHelp));
|
||||
help->usage = "Some usage";
|
||||
gchar *args[] = { NULL };
|
||||
|
||||
expect_cons_show("Usage: Some usage");
|
||||
|
||||
gboolean result = cmd_pgp(NULL, args, *help);
|
||||
assert_true(result);
|
||||
|
||||
free(help);
|
||||
}
|
||||
|
||||
#else
|
||||
void cmd_pgp_shows_message_when_pgp_unsupported(void **state)
|
||||
{
|
||||
CommandHelp *help = malloc(sizeof(CommandHelp));
|
||||
gchar *args[] = { "gen", NULL };
|
||||
|
||||
expect_cons_show("This version of Profanity has not been built with PGP support enabled");
|
||||
|
||||
gboolean result = cmd_pgp(NULL, args, *help);
|
||||
assert_true(result);
|
||||
|
||||
free(help);
|
||||
}
|
||||
#endif
|
||||
Reference in New Issue
Block a user