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:
@@ -7,7 +7,7 @@
|
||||
#include "plugins/plugins.h"
|
||||
|
||||
void
|
||||
returns_no_commands(void** state)
|
||||
plugins_get_command_names__returns__no_commands(void** state)
|
||||
{
|
||||
plugins_init();
|
||||
GList* commands = plugins_get_command_names();
|
||||
@@ -16,7 +16,7 @@ returns_no_commands(void** state)
|
||||
}
|
||||
|
||||
void
|
||||
returns_commands(void** state)
|
||||
plugins_get_command_names__returns__commands_when_added(void** state)
|
||||
{
|
||||
plugins_init();
|
||||
PluginCommand* command1 = g_new0(PluginCommand, 1);
|
||||
|
||||
@@ -1,2 +1,7 @@
|
||||
void returns_no_commands(void** state);
|
||||
void returns_commands(void** state);
|
||||
#ifndef TESTS_TEST_CALLBACKS_H
|
||||
#define TESTS_TEST_CALLBACKS_H
|
||||
|
||||
void plugins_get_command_names__returns__no_commands(void** state);
|
||||
void plugins_get_command_names__returns__commands_when_added(void** state);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include "plugins/disco.h"
|
||||
|
||||
void
|
||||
returns_empty_list_when_none(void** state)
|
||||
disco_get_features__returns__empty_list_when_none(void** state)
|
||||
{
|
||||
disco_close();
|
||||
GList* features = disco_get_features();
|
||||
@@ -16,7 +16,7 @@ returns_empty_list_when_none(void** state)
|
||||
}
|
||||
|
||||
void
|
||||
returns_added_feature(void** state)
|
||||
disco_add_feature__updates__added_feature(void** state)
|
||||
{
|
||||
disco_close();
|
||||
disco_add_feature("my_plugin", "some:feature:example");
|
||||
@@ -31,7 +31,7 @@ returns_added_feature(void** state)
|
||||
}
|
||||
|
||||
void
|
||||
resets_features_on_close(void** state)
|
||||
disco_close__updates__resets_features(void** state)
|
||||
{
|
||||
disco_close();
|
||||
disco_add_feature("my_plugin", "some:feature:example");
|
||||
@@ -49,7 +49,7 @@ resets_features_on_close(void** state)
|
||||
}
|
||||
|
||||
void
|
||||
returns_all_added_features(void** state)
|
||||
disco_get_features__returns__all_added_features(void** state)
|
||||
{
|
||||
disco_close();
|
||||
disco_add_feature("first_plugin", "first:feature");
|
||||
@@ -72,7 +72,7 @@ returns_all_added_features(void** state)
|
||||
}
|
||||
|
||||
void
|
||||
does_not_add_duplicate_feature(void** state)
|
||||
disco_add_feature__updates__not_duplicate_feature(void** state)
|
||||
{
|
||||
disco_close();
|
||||
disco_add_feature("my_plugin", "my:feature");
|
||||
@@ -86,7 +86,7 @@ does_not_add_duplicate_feature(void** state)
|
||||
}
|
||||
|
||||
void
|
||||
removes_plugin_features(void** state)
|
||||
disco_remove_features__updates__removes_plugin_features(void** state)
|
||||
{
|
||||
disco_close();
|
||||
disco_add_feature("plugin1", "plugin1:feature1");
|
||||
@@ -107,7 +107,7 @@ removes_plugin_features(void** state)
|
||||
}
|
||||
|
||||
void
|
||||
does_not_remove_feature_when_more_than_one_reference(void** state)
|
||||
disco_remove_features__updates__not_remove_when_more_than_one_reference(void** state)
|
||||
{
|
||||
disco_close();
|
||||
disco_add_feature("plugin1", "feature1");
|
||||
|
||||
@@ -1,7 +1,12 @@
|
||||
void returns_empty_list_when_none(void** state);
|
||||
void returns_added_feature(void** state);
|
||||
void resets_features_on_close(void** state);
|
||||
void returns_all_added_features(void** state);
|
||||
void does_not_add_duplicate_feature(void** state);
|
||||
void removes_plugin_features(void** state);
|
||||
void does_not_remove_feature_when_more_than_one_reference(void** state);
|
||||
#ifndef TESTS_TEST_PLUGINS_DISCO_H
|
||||
#define TESTS_TEST_PLUGINS_DISCO_H
|
||||
|
||||
void disco_get_features__returns__empty_list_when_none(void** state);
|
||||
void disco_add_feature__updates__added_feature(void** state);
|
||||
void disco_close__updates__resets_features(void** state);
|
||||
void disco_get_features__returns__all_added_features(void** state);
|
||||
void disco_add_feature__updates__not_duplicate_feature(void** state);
|
||||
void disco_remove_features__updates__removes_plugin_features(void** state);
|
||||
void disco_remove_features__updates__not_remove_when_more_than_one_reference(void** state);
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user