From 1ef6e84012387866eea21ba55a9c5bf2bee2d35f Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Sun, 26 Jul 2020 23:22:06 +0100 Subject: [PATCH] tests: Add some tests for expanding invalid escapes with g_strcompress() This brings the branch coverage of `g_strcompress()` up to 100%. Yay. Signed-off-by: Philip Withnall --- glib/tests/strfuncs.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/glib/tests/strfuncs.c b/glib/tests/strfuncs.c index 14b4d6c05..ea87c7d1e 100644 --- a/glib/tests/strfuncs.c +++ b/glib/tests/strfuncs.c @@ -741,6 +741,12 @@ test_strcompress_strescape (void) 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() */