diff options
author | WaLyong Cho <walyong.cho@samsung.com> | 2014-11-12 19:49:31 +0900 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2014-12-04 02:09:44 +0100 |
commit | fec8457652002fd5bff923042a7407b3810f5a7f (patch) | |
tree | 94f038e2c98fb54c228b82d32fe72c61ab47bee5 /src/test | |
parent | da64a1fc41e84bdb67c56693fff685b5eff2a2c7 (diff) |
utf8: intruduce utf8_escape_non_printable
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/test-utf8.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/test/test-utf8.c b/src/test/test-utf8.c index b7d988f22d..6dde63cdff 100644 --- a/src/test/test-utf8.c +++ b/src/test/test-utf8.c @@ -66,12 +66,37 @@ static void test_utf8_escaping(void) { assert_se(utf8_is_valid(p3)); } +static void test_utf8_escaping_printable(void) { + _cleanup_free_ char *p1, *p2, *p3, *p4, *p5; + + p1 = utf8_escape_non_printable("goo goo goo"); + puts(p1); + assert_se(utf8_is_valid(p1)); + + p2 = utf8_escape_non_printable("\341\204\341\204"); + puts(p2); + assert_se(utf8_is_valid(p2)); + + p3 = utf8_escape_non_printable("\341\204"); + puts(p3); + assert_se(utf8_is_valid(p3)); + + p4 = utf8_escape_non_printable("ąę\n가너도루\n1234\n\341\204\341\204\n\001 \019\20\a"); + puts(p4); + assert_se(utf8_is_valid(p4)); + + p5 = utf8_escape_non_printable("\001 \019\20\a"); + puts(p5); + assert_se(utf8_is_valid(p5)); +} + 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(); + test_utf8_escaping_printable(); return 0; } |