mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-08 13:38:43 +02:00
libnm/tests: always check expected default value for string properties in test_setting_metadata()
This commit is contained in:
parent
572ce7b7a7
commit
d805b9ae51
1 changed files with 9 additions and 9 deletions
|
|
@ -4647,19 +4647,19 @@ check_done:;
|
||||||
g_object_get_property(G_OBJECT(setting), sip->name, &val);
|
g_object_get_property(G_OBJECT(setting), sip->name, &val);
|
||||||
|
|
||||||
if (sip->param_spec->value_type == G_TYPE_STRING) {
|
if (sip->param_spec->value_type == G_TYPE_STRING) {
|
||||||
|
const char *exp_default_value = NULL;
|
||||||
const char *default_value;
|
const char *default_value;
|
||||||
|
|
||||||
default_value = ((const GParamSpecString *) sip->param_spec)->default_value;
|
default_value = ((const GParamSpecString *) sip->param_spec)->default_value;
|
||||||
if (default_value) {
|
|
||||||
/* having a string property with a default != NULL is really ugly. They
|
/* having a string property with a default != NULL is really ugly. They
|
||||||
* should be best avoided... */
|
* should be best avoided... Only one property is known to have a non-NULL
|
||||||
if (meta_type == NM_META_SETTING_TYPE_DCB
|
* default. Assert that this stays. */
|
||||||
&& nm_streq(sip->name, NM_SETTING_DCB_APP_FCOE_MODE)) {
|
if (meta_type == NM_META_SETTING_TYPE_DCB
|
||||||
/* Whitelist the properties that have a non-NULL default value. */
|
&& nm_streq(sip->name, NM_SETTING_DCB_APP_FCOE_MODE)) {
|
||||||
g_assert_cmpstr(default_value, ==, NM_SETTING_DCB_FCOE_MODE_FABRIC);
|
exp_default_value = NM_SETTING_DCB_FCOE_MODE_FABRIC;
|
||||||
} else
|
|
||||||
g_assert_not_reached();
|
|
||||||
}
|
}
|
||||||
|
g_assert_cmpstr(default_value, ==, exp_default_value);
|
||||||
|
|
||||||
if (nm_streq(sip->name, NM_SETTING_NAME))
|
if (nm_streq(sip->name, NM_SETTING_NAME))
|
||||||
g_assert_cmpstr(g_value_get_string(&val), ==, msi->setting_name);
|
g_assert_cmpstr(g_value_get_string(&val), ==, msi->setting_name);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue