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:
parent
7e956fb347
commit
60e03094c3
@ -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)
|
||||
{
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user