1
0
mirror of https://github.com/systemd/systemd.git synced 2024-12-23 21:35:11 +03:00

test-locale-util: show special glyphs

This is mostly useful as a sanity check.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2018-04-18 10:53:25 +02:00 committed by Lennart Poettering
parent 7c6c2e07fc
commit e206fcc164

View File

@ -26,6 +26,8 @@ static void test_get_locales(void) {
}
static void test_locale_is_valid(void) {
log_info("/* %s */", __func__);
assert_se(locale_is_valid("en_EN.utf8"));
assert_se(locale_is_valid("fr_FR.utf8"));
assert_se(locale_is_valid("fr_FR@euro"));
@ -43,6 +45,8 @@ static void test_keymaps(void) {
char **p;
int r;
log_info("/* %s */", __func__);
assert_se(!keymap_is_valid(""));
assert_se(!keymap_is_valid("/usr/bin/foo"));
assert_se(!keymap_is_valid("\x01gar\x02 bage\x03"));
@ -65,11 +69,31 @@ static void test_keymaps(void) {
assert_se(keymap_is_valid("unicode"));
}
#define dump_glyph(x) log_info(STRINGIFY(x) ": %s", special_glyph(x))
static void dump_special_glyphs(void) {
assert_cc(ELLIPSIS + 1 == _SPECIAL_GLYPH_MAX);
log_info("/* %s */", __func__);
log_info("is_locale_utf8: %s", yes_no(is_locale_utf8()));
dump_glyph(TREE_VERTICAL);
dump_glyph(TREE_BRANCH);
dump_glyph(TREE_RIGHT);
dump_glyph(TREE_SPACE);
dump_glyph(TRIANGULAR_BULLET);
dump_glyph(BLACK_CIRCLE);
dump_glyph(ARROW);
dump_glyph(MDASH);
dump_glyph(ELLIPSIS);
}
int main(int argc, char *argv[]) {
test_get_locales();
test_locale_is_valid();
test_keymaps();
dump_special_glyphs();
return 0;
}