tests: standardize naming convention

Use a behavior-driven naming convention for unit tests.

Functions are now named using the pattern: [unit]__[verb]__[scenario]
The __ works as a semantic separator.

Examples:
* jid_create__returns__null_from_null()
* cmd_connect__shows__usage_when_no_server_value

Benefits:
* Easy to find all tests associated with a specific function using the
  mandatory prefix.
* Test output in CI now explicitly describes the unit, the expected
  outcome, and the scenario being tested.

Also disabled keyhandlers tests due to missing code in src/ui.
This commit is contained in:
Michael Vetter
2026-02-28 12:41:33 +01:00
parent a7408a970e
commit e81435be06
53 changed files with 1601 additions and 1433 deletions

View File

@@ -15,7 +15,7 @@
#include "ui/window_list.h"
void
console_shows_online_presence_when_set_online(void** state)
sv_ev_contact_online__shows__presence_in_console_when_set_online(void** state)
{
prefs_set_string(PREF_STATUSES_CONSOLE, "online");
plugins_init();
@@ -35,7 +35,7 @@ console_shows_online_presence_when_set_online(void** state)
}
void
console_shows_online_presence_when_set_all(void** state)
sv_ev_contact_online__shows__presence_in_console_when_set_all(void** state)
{
prefs_set_string(PREF_STATUSES_CONSOLE, "all");
plugins_init();
@@ -55,7 +55,7 @@ console_shows_online_presence_when_set_all(void** state)
}
void
console_shows_dnd_presence_when_set_all(void** state)
sv_ev_contact_online__shows__dnd_presence_in_console_when_set_all(void** state)
{
prefs_set_string(PREF_STATUSES_CONSOLE, "all");
plugins_init();
@@ -75,7 +75,7 @@ console_shows_dnd_presence_when_set_all(void** state)
}
void
handle_offline_removes_chat_session(void** state)
sv_ev_contact_offline__updates__removes_chat_session(void** state)
{
plugins_init();
roster_create();
@@ -100,7 +100,7 @@ handle_offline_removes_chat_session(void** state)
}
void
lost_connection_clears_chat_sessions(void** state)
sv_ev_lost_connection__updates__clears_chat_sessions(void** state)
{
roster_create();
roster_process_pending_presence();

View File

@@ -1,14 +1,10 @@
void console_doesnt_show_online_presence_when_set_none(void** state);
void console_shows_online_presence_when_set_online(void** state);
void console_shows_online_presence_when_set_all(void** state);
void console_doesnt_show_dnd_presence_when_set_none(void** state);
void console_doesnt_show_dnd_presence_when_set_online(void** state);
void console_shows_dnd_presence_when_set_all(void** state);
void handle_message_error_when_no_recipient(void** state);
void handle_message_error_when_recipient_cancel(void** state);
void handle_message_error_when_recipient_cancel_disables_chat_session(void** state);
void handle_message_error_when_recipient_and_no_type(void** state);
void handle_presence_error_when_no_recipient(void** state);
void handle_presence_error_when_from_recipient(void** state);
void handle_offline_removes_chat_session(void** state);
void lost_connection_clears_chat_sessions(void** state);
#ifndef TESTS_TEST_SERVER_EVENTS_H
#define TESTS_TEST_SERVER_EVENTS_H
void sv_ev_contact_online__shows__presence_in_console_when_set_online(void** state);
void sv_ev_contact_online__shows__presence_in_console_when_set_all(void** state);
void sv_ev_contact_online__shows__dnd_presence_in_console_when_set_all(void** state);
void sv_ev_contact_offline__updates__removes_chat_session(void** state);
void sv_ev_lost_connection__updates__clears_chat_sessions(void** state);
#endif