mirror of
https://github.com/profanity-im/profanity.git
synced 2025-01-03 14:57:42 -05:00
Added cmd_connect test for repeated port property
This commit is contained in:
parent
21f0bd04a8
commit
91d4097df9
@ -110,6 +110,11 @@ cmd_connect(gchar **args, struct cmd_help_t help)
|
|||||||
cons_show("");
|
cons_show("");
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
if (port_set && strcmp("port", opt2) == 0) {
|
||||||
|
cons_show("Usage: %s", help.usage);
|
||||||
|
cons_show("");
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
if (opt2val == NULL) {
|
if (opt2val == NULL) {
|
||||||
cons_show("Usage: %s", help.usage);
|
cons_show("Usage: %s", help.usage);
|
||||||
cons_show("");
|
cons_show("");
|
||||||
|
@ -219,6 +219,25 @@ void cmd_connect_shows_usage_when_server_provided_twice(void **state)
|
|||||||
free(help);
|
free(help);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void cmd_connect_shows_usage_when_port_provided_twice(void **state)
|
||||||
|
{
|
||||||
|
stub_ui_ask_password();
|
||||||
|
mock_cons_show();
|
||||||
|
CommandHelp *help = malloc(sizeof(CommandHelp));
|
||||||
|
help->usage = "some usage";
|
||||||
|
gchar *args[] = { "user@server.org", "port", "1111", "port", "1111", NULL };
|
||||||
|
|
||||||
|
mock_connection_status(JABBER_DISCONNECTED);
|
||||||
|
|
||||||
|
expect_cons_show("Usage: some usage");
|
||||||
|
expect_cons_show("");
|
||||||
|
|
||||||
|
gboolean result = cmd_connect(args, *help);
|
||||||
|
assert_true(result);
|
||||||
|
|
||||||
|
free(help);
|
||||||
|
}
|
||||||
|
|
||||||
void cmd_connect_when_no_account(void **state)
|
void cmd_connect_when_no_account(void **state)
|
||||||
{
|
{
|
||||||
mock_cons_show();
|
mock_cons_show();
|
||||||
|
@ -22,3 +22,4 @@ void cmd_connect_with_server_when_provided(void **state);
|
|||||||
void cmd_connect_with_port_when_provided(void **state);
|
void cmd_connect_with_port_when_provided(void **state);
|
||||||
void cmd_connect_with_server_and_port_when_provided(void **state);
|
void cmd_connect_with_server_and_port_when_provided(void **state);
|
||||||
void cmd_connect_shows_usage_when_server_provided_twice(void **state);
|
void cmd_connect_shows_usage_when_server_provided_twice(void **state);
|
||||||
|
void cmd_connect_shows_usage_when_port_provided_twice(void **state);
|
||||||
|
@ -191,6 +191,7 @@ int main(int argc, char* argv[]) {
|
|||||||
unit_test(cmd_connect_with_port_when_provided),
|
unit_test(cmd_connect_with_port_when_provided),
|
||||||
unit_test(cmd_connect_with_server_and_port_when_provided),
|
unit_test(cmd_connect_with_server_and_port_when_provided),
|
||||||
unit_test(cmd_connect_shows_usage_when_server_provided_twice),
|
unit_test(cmd_connect_shows_usage_when_server_provided_twice),
|
||||||
|
unit_test(cmd_connect_shows_usage_when_port_provided_twice),
|
||||||
|
|
||||||
unit_test(cmd_rooms_shows_message_when_disconnected),
|
unit_test(cmd_rooms_shows_message_when_disconnected),
|
||||||
unit_test(cmd_rooms_shows_message_when_disconnecting),
|
unit_test(cmd_rooms_shows_message_when_disconnecting),
|
||||||
|
Loading…
Reference in New Issue
Block a user