summaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2014-01-17 21:28:41 -0500
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2014-02-08 13:07:39 -0500
commit550a40eceb7d1917152fc9317bf2696708d52bc2 (patch)
tree929a5bac5264ad95783b1a68897daa67e3a25428 /src/test
parentcda7ecb0a3d6cf839ec484a6690c12857a6e8375 (diff)
core: do not print invalid utf-8 in error messages
Diffstat (limited to 'src/test')
-rw-r--r--src/test/test-utf8.c17
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;
}