mirror of
https://github.com/systemd/systemd.git
synced 2025-01-11 09:18:07 +03:00
test-utf8: add a smoke test for utf8_console_width()
This commit is contained in:
parent
99f1229d76
commit
7c6c2e07fc
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user