tests: Test that UTF-8 is escaped correctly by g_strescape()

`g_strescape()` is documented as escaping UTF-8 characters, so test that
it does.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

Fixes: #4
This commit is contained in:
Philip Withnall 2020-07-26 23:04:37 +01:00
parent a84f241dd7
commit 437526675a

View File

@ -731,6 +731,16 @@ 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);
}
/* Testing g_ascii_strcasecmp() and g_ascii_strncasecmp() */