mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-28 00:16:15 +01:00
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:
commit
62a54a90b2
@ -731,6 +731,22 @@ test_strcompress_strescape (void)
|
|||||||
g_assert_cmpstr (str, ==, "abc\\\"\b\f\n\r\t\v\003\177\234\313");
|
g_assert_cmpstr (str, ==, "abc\\\"\b\f\n\r\t\v\003\177\234\313");
|
||||||
g_free (str);
|
g_free (str);
|
||||||
g_free (tmp);
|
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() */
|
/* Testing g_ascii_strcasecmp() and g_ascii_strncasecmp() */
|
||||||
|
@ -382,7 +382,7 @@ test_uri_unescape_bytes (gconstpointer test_data)
|
|||||||
tests[] =
|
tests[] =
|
||||||
{
|
{
|
||||||
{ "%00%00", NULL, 2, (const guint8 *) "\x00\x00" },
|
{ "%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 },
|
{ "/cursors%2fbad-subdir/none.png", "/", -1, NULL },
|
||||||
{ "%%", NULL, -1, NULL },
|
{ "%%", NULL, -1, NULL },
|
||||||
{ "%", NULL, -1, NULL },
|
{ "%", NULL, -1, NULL },
|
||||||
|
Loading…
Reference in New Issue
Block a user