2014-04-01 18:54:26 -04:00
|
|
|
#include <stdarg.h>
|
|
|
|
#include <stddef.h>
|
|
|
|
#include <setjmp.h>
|
|
|
|
#include <cmocka.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <glib.h>
|
|
|
|
|
|
|
|
#include "ui/ui.h"
|
2014-12-24 19:08:46 -05:00
|
|
|
#include "ui/stub_ui.h"
|
2014-04-01 18:54:26 -04:00
|
|
|
|
|
|
|
#include "command/commands.h"
|
|
|
|
|
|
|
|
void cmd_win_shows_message_when_win_doesnt_exist(void **state)
|
|
|
|
{
|
|
|
|
CommandHelp *help = malloc(sizeof(CommandHelp));
|
|
|
|
gchar *args[] = { "3", NULL };
|
|
|
|
|
2015-04-21 18:28:52 -04:00
|
|
|
expect_value(ui_switch_win_num, i, 3);
|
|
|
|
will_return(ui_switch_win_num, FALSE);
|
2014-12-24 19:08:46 -05:00
|
|
|
|
2014-04-01 18:54:26 -04:00
|
|
|
expect_cons_show("Window 3 does not exist.");
|
|
|
|
|
|
|
|
gboolean result = cmd_win(args, *help);
|
|
|
|
assert_true(result);
|
|
|
|
|
|
|
|
free(help);
|
|
|
|
}
|
|
|
|
|
|
|
|
void cmd_win_switches_to_given_win_when_exists(void **state)
|
|
|
|
{
|
|
|
|
CommandHelp *help = malloc(sizeof(CommandHelp));
|
|
|
|
gchar *args[] = { "12", NULL };
|
|
|
|
|
2015-04-21 18:28:52 -04:00
|
|
|
expect_value(ui_switch_win_num, i, 12);
|
|
|
|
will_return(ui_switch_win_num, TRUE);
|
2014-04-01 18:54:26 -04:00
|
|
|
|
|
|
|
gboolean result = cmd_win(args, *help);
|
|
|
|
assert_true(result);
|
|
|
|
|
|
|
|
free(help);
|
|
|
|
}
|