diff options
author | James Booth <boothj5@gmail.com> | 2014-02-16 14:44:40 +0000 |
---|---|---|
committer | James Booth <boothj5@gmail.com> | 2014-02-16 14:44:40 +0000 |
commit | 60e03094c3fd066283468fe094625bbd5a9a27ff (patch) | |
tree | 3ccf608395eefcf0f74d7be0cc318414e5b53bda /tests | |
parent | 7e956fb34740c691d2fc79faff864e2e9a445dab (diff) | |
download | profani-tty-60e03094c3fd066283468fe094625bbd5a9a27ff.tar.gz |
Added test for /otr libver
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_cmd_otr.c | 18 | ||||
-rw-r--r-- | tests/test_cmd_otr.h | 1 | ||||
-rw-r--r-- | tests/testsuite.c | 1 |
3 files changed, 20 insertions, 0 deletions
diff --git a/tests/test_cmd_otr.c b/tests/test_cmd_otr.c index 124f52f9..8bc25fcd 100644 --- a/tests/test_cmd_otr.c +++ b/tests/test_cmd_otr.c @@ -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) { diff --git a/tests/test_cmd_otr.h b/tests/test_cmd_otr.h index bfb39a2d..137d7e7d 100644 --- a/tests/test_cmd_otr.h +++ b/tests/test_cmd_otr.h @@ -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 diff --git a/tests/testsuite.c b/tests/testsuite.c index 0a34bad2..38e535aa 100644 --- a/tests/testsuite.c +++ b/tests/testsuite.c @@ -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 |