summaryrefslogtreecommitdiff
path: root/src/test/test-utf8.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2014-12-04 02:27:14 +0100
committerLennart Poettering <lennart@poettering.net>2014-12-04 02:27:14 +0100
commit3c6d3052d3597100e9d531df03cb15e9988dc94d (patch)
tree4ad648a42698befd049fcc95167731fff428d099 /src/test/test-utf8.c
parent3f18c60b2e09d1191ffede3aeabd967b57a1f918 (diff)
utf8: when escaping unprintable unichars, escape the whole unichar, not just the first byte of it
Diffstat (limited to 'src/test/test-utf8.c')
-rw-r--r--src/test/test-utf8.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/test/test-utf8.c b/src/test/test-utf8.c
index 6dde63cdff..3399f2ba9c 100644
--- a/src/test/test-utf8.c
+++ b/src/test/test-utf8.c
@@ -47,7 +47,6 @@ static void test_utf8_encoded_valid_unichar(void) {
assert_se(utf8_encoded_valid_unichar("a") == 1);
assert_se(utf8_encoded_valid_unichar("\341\204") < 0);
assert_se(utf8_encoded_valid_unichar("\341\204\341\204") < 0);
-
}
static void test_utf8_escaping(void) {
@@ -67,7 +66,7 @@ static void test_utf8_escaping(void) {
}
static void test_utf8_escaping_printable(void) {
- _cleanup_free_ char *p1, *p2, *p3, *p4, *p5;
+ _cleanup_free_ char *p1, *p2, *p3, *p4, *p5, *p6;
p1 = utf8_escape_non_printable("goo goo goo");
puts(p1);
@@ -88,6 +87,10 @@ static void test_utf8_escaping_printable(void) {
p5 = utf8_escape_non_printable("\001 \019\20\a");
puts(p5);
assert_se(utf8_is_valid(p5));
+
+ p6 = utf8_escape_non_printable("\xef\xbf\x30\x13");
+ puts(p6);
+ assert_se(utf8_is_valid(p6));
}
int main(int argc, char *argv[]) {