mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-08 10:14:04 +02:00
tests: Separate invalid escaping tests for GKeyFile
One test key was serving two purposes, which meant tests for it couldn’t be separated out. It was testing escape-at-end-of-line and also invalid-escape. Signed-off-by: Philip Withnall <pwithnall@endlessos.org> Helps: #3098
This commit is contained in:
@@ -589,8 +589,9 @@ test_string (void)
|
|||||||
"key6=trailing space \n"
|
"key6=trailing space \n"
|
||||||
"[invalid]\n"
|
"[invalid]\n"
|
||||||
"key1=\\a\\b\\0800xff\n"
|
"key1=\\a\\b\\0800xff\n"
|
||||||
"key2=blabla\\\n"
|
"key2=blabla\\\n" /* escape at end of line */
|
||||||
"key3=foo\\i\\\n";
|
"key3=\\ifoo\n" /* invalid escape */
|
||||||
|
"key4=\\i\\hfoo\n"; /* invalid escape with multiple stacked errors */
|
||||||
|
|
||||||
keyfile = load_data (data, 0);
|
keyfile = load_data (data, 0);
|
||||||
|
|
||||||
@@ -613,6 +614,10 @@ test_string (void)
|
|||||||
check_error (&error, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_INVALID_VALUE);
|
check_error (&error, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_INVALID_VALUE);
|
||||||
g_free (value);
|
g_free (value);
|
||||||
|
|
||||||
|
value = g_key_file_get_string (keyfile, "invalid", "key4", &error);
|
||||||
|
check_error (&error, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_INVALID_VALUE);
|
||||||
|
g_free (value);
|
||||||
|
|
||||||
g_key_file_set_string (keyfile, "inserted", "key1", "simple");
|
g_key_file_set_string (keyfile, "inserted", "key1", "simple");
|
||||||
g_key_file_set_string (keyfile, "inserted", "key2", " leading space");
|
g_key_file_set_string (keyfile, "inserted", "key2", " leading space");
|
||||||
g_key_file_set_string (keyfile, "inserted", "key3", "\tleading tab");
|
g_key_file_set_string (keyfile, "inserted", "key3", "\tleading tab");
|
||||||
|
Reference in New Issue
Block a user