diff options
Diffstat (limited to 'src/test/test-utf8.c')
-rw-r--r-- | src/test/test-utf8.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/test/test-utf8.c b/src/test/test-utf8.c index d2198fdc74..b7d988f22d 100644 --- a/src/test/test-utf8.c +++ b/src/test/test-utf8.c @@ -50,11 +50,28 @@ static void test_utf8_encoded_valid_unichar(void) { } +static void test_utf8_escaping(void) { + _cleanup_free_ char *p1, *p2, *p3; + + p1 = utf8_escape_invalid("goo goo goo"); + puts(p1); + assert_se(utf8_is_valid(p1)); + + p2 = utf8_escape_invalid("\341\204\341\204"); + puts(p2); + assert_se(utf8_is_valid(p2)); + + p3 = utf8_escape_invalid("\341\204"); + puts(p3); + assert_se(utf8_is_valid(p3)); +} + int main(int argc, char *argv[]) { test_utf8_is_valid(); test_utf8_is_printable(); test_ascii_is_valid(); test_utf8_encoded_valid_unichar(); + test_utf8_escaping(); return 0; } |