Merge branch '4-strescape-utf8' into 'master'

Add some g_strescape() tests

Closes #4

See merge request GNOME/glib!1584
This commit is contained in:
Sebastian Dröge 2020-07-27 11:49:44 +00:00
commit 62a54a90b2
2 changed files with 17 additions and 1 deletions

View File

@ -731,6 +731,22 @@ test_strcompress_strescape (void)
g_assert_cmpstr (str, ==, "abc\\\"\b\f\n\r\t\v\003\177\234\313");
g_free (str);
g_free (tmp);
/* Unicode round trip */
str = g_strescape ("héllø there⸘", NULL);
g_assert_nonnull (str);
g_assert_cmpstr (str, ==, "h\\303\\251ll\\303\\270 there\\342\\270\\230");
tmp = g_strcompress (str);
g_assert_nonnull (tmp);
g_assert_cmpstr (tmp, ==, "héllø there⸘");
g_free (tmp);
g_free (str);
/* Test expanding invalid escapes */
str = g_strcompress ("\\11/ \\118 \\8aa \\19");
g_assert_nonnull (str);
g_assert_cmpstr (str, ==, "\t/ \t8 8aa \0019");
g_free (str);
}
/* Testing g_ascii_strcasecmp() and g_ascii_strncasecmp() */

View File

@ -382,7 +382,7 @@ test_uri_unescape_bytes (gconstpointer test_data)
tests[] =
{
{ "%00%00", NULL, 2, (const guint8 *) "\x00\x00" },
{ "/cursors/none.png", "/", 17, "/cursors/none.png" },
{ "/cursors/none.png", "/", 17, (const guint8 *) "/cursors/none.png" },
{ "/cursors%2fbad-subdir/none.png", "/", -1, NULL },
{ "%%", NULL, -1, NULL },
{ "%", NULL, -1, NULL },