about summary refs log tree commit diff stats
path: root/tests/ui
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2014-12-24 21:34:11 +0000
committerJames Booth <boothj5@gmail.com>2014-12-24 21:34:11 +0000
commit5319a03aebfbaf5ecfb32656429834ece3afaf9a (patch)
treee8ec8887757e5090e37a30c5a31406736a59d027 /tests/ui
parent3487100c0f7ede4885d5c178faf3c3df5902efb8 (diff)
downloadprofani-tty-5319a03aebfbaf5ecfb32656429834ece3afaf9a.tar.gz
Added cmd_connect tests
Diffstat (limited to 'tests/ui')
-rw-r--r--tests/ui/stub_ui.c19
-rw-r--r--tests/ui/stub_ui.h1
2 files changed, 18 insertions, 2 deletions
diff --git a/tests/ui/stub_ui.c b/tests/ui/stub_ui.c
index 7115d2c3..310721e5 100644
--- a/tests/ui/stub_ui.c
+++ b/tests/ui/stub_ui.c
@@ -19,6 +19,12 @@ expect_cons_show(char *expected)
     expect_string(cons_show, output, expected);
 }
 
+void
+expect_cons_show_error(char *expected)
+{
+    expect_string(cons_show_error, output, expected);
+}
+
 // stubs
 
 void ui_init(void) {}
@@ -129,7 +135,7 @@ int ui_win_unread(int index)
 
 char * ui_ask_password(void)
 {
-    return NULL;
+    return mock_ptr_type(char *);
 }
 
 void ui_handle_stanza(const char * const msg) {}
@@ -305,7 +311,16 @@ void cons_show_account(ProfAccount *account)
 void cons_debug(const char * const msg, ...) {}
 void cons_show_time(void) {}
 void cons_show_word(const char * const word) {}
-void cons_show_error(const char * const cmd, ...) {}
+
+void cons_show_error(const char * const cmd, ...)
+{
+    va_list args;
+    va_start(args, cmd);
+    vsnprintf(output, sizeof(output), cmd, args);
+    check_expected(output);
+    va_end(args);
+}
+
 void cons_show_contacts(GSList * list) {}
 void cons_show_roster(GSList * list) {}
 void cons_show_roster_group(const char * const group, GSList * list) {}
diff --git a/tests/ui/stub_ui.h b/tests/ui/stub_ui.h
index dbddda9b..31c2a120 100644
--- a/tests/ui/stub_ui.h
+++ b/tests/ui/stub_ui.h
@@ -1 +1,2 @@
 void expect_cons_show(char *expected);
+void expect_cons_show_error(char *expected);