diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2018-04-18 10:57:01 +0200 |
---|---|---|
committer | Sven Eden <yamakuzure@gmx.net> | 2018-08-24 16:47:08 +0200 |
commit | 46030154635721dd13254eb5bdacfaa4382e45e3 (patch) | |
tree | 9ebd259d3feb7324837c51b162463a654a119d0e /src | |
parent | 8ccd911eb090ec15d5ee47b84f911a27f0cb59a4 (diff) |
test-utf8: add a smoke test for utf8_console_width()
Diffstat (limited to 'src')
-rw-r--r-- | src/test/test-utf8.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/test/test-utf8.c b/src/test/test-utf8.c index a7bbc9b42..ec963437b 100644 --- a/src/test/test-utf8.c +++ b/src/test/test-utf8.c @@ -102,6 +102,15 @@ static void test_utf8_n_codepoints(void) { assert_se(utf8_n_codepoints("\xF1") == (size_t) -1); } +static void test_utf8_console_width(void) { + assert_se(utf8_console_width("abc") == 3); + assert_se(utf8_console_width("zażółcić gęślą jaźń") == 19); + assert_se(utf8_console_width("串") == 2); + assert_se(utf8_console_width("") == 0); + assert_se(utf8_console_width("…👊🔪💐…") == 8); + assert_se(utf8_console_width("\xF1") == (size_t) -1); +} + int main(int argc, char *argv[]) { test_utf8_is_valid(); test_utf8_is_printable(); @@ -111,6 +120,7 @@ int main(int argc, char *argv[]) { test_utf8_escaping_printable(); test_utf16_to_utf8(); test_utf8_n_codepoints(); + test_utf8_console_width(); return 0; } |