Add a test for grup names of length 1.

2005-09-14  Matthias Clasen  <mclasen@redhat.com>

	* tests/keyfile-test.c: Add a test for grup names of length 1.

	* glib/gkeyfile.c (g_key_file_line_is_group): Accept group names
	of length 1.  (#316309)
This commit is contained in:
Matthias Clasen 2005-09-14 18:04:53 +00:00 committed by Matthias Clasen
parent 047558bc21
commit 81719cc164
5 changed files with 42 additions and 6 deletions

View File

@ -1,3 +1,10 @@
2005-09-14 Matthias Clasen <mclasen@redhat.com>
* tests/keyfile-test.c: Add a test for grup names of length 1.
* glib/gkeyfile.c (g_key_file_line_is_group): Accept group names
of length 1. (#316309)
2005-09-12 Matthias Clasen <mclasen@redhat.com>
* glib/gmarkup.c (g_markup_escape_text): Clarify docs.

View File

@ -1,3 +1,10 @@
2005-09-14 Matthias Clasen <mclasen@redhat.com>
* tests/keyfile-test.c: Add a test for grup names of length 1.
* glib/gkeyfile.c (g_key_file_line_is_group): Accept group names
of length 1. (#316309)
2005-09-12 Matthias Clasen <mclasen@redhat.com>
* glib/gmarkup.c (g_markup_escape_text): Clarify docs.

View File

@ -1,3 +1,10 @@
2005-09-14 Matthias Clasen <mclasen@redhat.com>
* tests/keyfile-test.c: Add a test for grup names of length 1.
* glib/gkeyfile.c (g_key_file_line_is_group): Accept group names
of length 1. (#316309)
2005-09-12 Matthias Clasen <mclasen@redhat.com>
* glib/gmarkup.c (g_markup_escape_text): Clarify docs.

View File

@ -2989,14 +2989,9 @@ g_key_file_line_is_group (const gchar *line)
p = g_utf8_next_char (p);
if (!*p)
return FALSE;
p = g_utf8_next_char (p);
/* Group name must be non-empty
*/
if (*p == ']')
if (!*p || *p == ']')
return FALSE;
while (*p && *p != ']')

View File

@ -755,6 +755,25 @@ test_lists (void)
g_key_file_free (keyfile);
}
static void
test_groups (void)
{
GKeyFile *keyfile;
const gchar *data =
"[1]\n"
"key1=123\n"
"[2]\n"
"key2=123\n";
keyfile = load_data (data, 0);
check_string_value (keyfile, "1", "key1", "123");
check_string_value (keyfile, "2", "key2", "123");
g_key_file_free (keyfile);
}
/* http://bugzilla.gnome.org/show_bug.cgi?id=165887 */
static void
test_group_remove (void)
@ -874,6 +893,7 @@ main (int argc, char *argv[])
test_lists ();
test_group_remove ();
test_key_remove ();
test_groups ();
return 0;
}