mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-02 07:23:41 +02:00
If the group is already there, make it current. (#385910, Joe Halliwell)
2006-12-14 Matthias Clasen <mclasen@redhat.com> * glib/gkeyfile.c (g_key_file_add_group): If the group is already there, make it current. (#385910, Joe Halliwell) * tests/keyfile-test.c: Add a test for duplicate groups/keys.
This commit is contained in:
committed by
Matthias Clasen
parent
b6aad8a6f0
commit
966872d789
@@ -1001,10 +1001,31 @@ test_duplicate_groups (void)
|
||||
"key2=123\n";
|
||||
|
||||
keyfile = load_data (data, 0);
|
||||
check_string_value (keyfile, "Desktop Entry", "key1", "123");
|
||||
check_string_value (keyfile, "Desktop Entry", "key2", "123");
|
||||
|
||||
g_key_file_free (keyfile);
|
||||
}
|
||||
|
||||
/* http://bugzilla.gnome.org/show_bug.cgi?id=385910 */
|
||||
static void
|
||||
test_duplicate_groups2 (void)
|
||||
{
|
||||
GKeyFile *keyfile;
|
||||
const gchar *data =
|
||||
"[A]\n"
|
||||
"foo=bar\n"
|
||||
"[B]\n"
|
||||
"foo=baz\n"
|
||||
"[A]\n"
|
||||
"foo=bang\n";
|
||||
|
||||
keyfile = load_data (data, 0);
|
||||
check_string_value (keyfile, "A", "foo", "bang");
|
||||
check_string_value (keyfile, "B", "foo", "baz");
|
||||
|
||||
g_key_file_free (keyfile);
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
@@ -1023,6 +1044,7 @@ main (int argc, char *argv[])
|
||||
test_groups ();
|
||||
test_duplicate_keys ();
|
||||
test_duplicate_groups ();
|
||||
test_duplicate_groups2 ();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user