1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-11-03 19:37:16 -05:00

Added test for /otr libver

This commit is contained in:
James Booth 2014-02-16 14:44:40 +00:00
parent 7e956fb347
commit 60e03094c3
3 changed files with 20 additions and 0 deletions

View File

@ -5,6 +5,7 @@
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <libotr/proto.h>
#include "config.h"
#include "config/preferences.h"
@ -238,6 +239,23 @@ void cmd_otr_warn_off_disables_unencrypted_warning(void **state)
free(help);
}
void cmd_otr_libver_shows_libotr_version(void **state)
{
mock_cons_show();
CommandHelp *help = malloc(sizeof(CommandHelp));
gchar *args[] = { "libver", NULL };
char *version = OTRL_VERSION;
GString *message = g_string_new("Using libotr version ");
g_string_append(message, version);
expect_cons_show(message->str);
gboolean result = cmd_otr(args, *help);
assert_true(result);
g_string_free(message, TRUE);
free(help);
}
#else
void cmd_otr_shows_message_when_otr_unsupported(void **state)
{

View File

@ -14,6 +14,7 @@ void cmd_otr_warn_shows_usage_when_no_args(void **state);
void cmd_otr_warn_shows_usage_when_invalid_arg(void **state);
void cmd_otr_warn_on_enables_unencrypted_warning(void **state);
void cmd_otr_warn_off_disables_unencrypted_warning(void **state);
void cmd_otr_libver_shows_libotr_version(void **state);
#else
void cmd_otr_shows_message_when_otr_unsupported(void **state);
#endif

View File

@ -455,6 +455,7 @@ int main(int argc, char* argv[]) {
unit_test_setup_teardown(cmd_otr_warn_off_disables_unencrypted_warning,
init_preferences,
close_preferences),
unit_test(cmd_otr_libver_shows_libotr_version),
#else
unit_test(cmd_otr_shows_message_when_otr_unsupported),
#endif