summaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authortblume <Thomas.Blume@suse.com>2017-11-10 10:31:44 +0100
committerSven Eden <yamakuzure@gmx.net>2017-11-10 10:31:44 +0100
commitf56ba2f20e14bd1422ea3b080772b602d079a8fc (patch)
treef3002c93643d3d9801a6d0d0b50ed2eab2ffa082 /src/test
parentea088fe1f51e8679b64e4536c6da1437435f45e6 (diff)
elogind-firstboot: add vconsole keymap support (#7035)
Enable elogind-firstboot to set the keymap. RFE: https://github.com/elogind/elogind/issues/6346
Diffstat (limited to 'src/test')
-rw-r--r--src/test/test-locale-util.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/test/test-locale-util.c b/src/test/test-locale-util.c
index 427c698d1..9e69567e4 100644
--- a/src/test/test-locale-util.c
+++ b/src/test/test-locale-util.c
@@ -50,9 +50,38 @@ static void test_locale_is_valid(void) {
assert_se(!locale_is_valid("\x01gar\x02 bage\x03"));
}
+static void test_keymaps(void) {
+ _cleanup_strv_free_ char **kmaps = NULL;
+ char **p;
+ int r;
+
+ assert_se(!keymap_is_valid(""));
+ assert_se(!keymap_is_valid("/usr/bin/foo"));
+ assert_se(!keymap_is_valid("\x01gar\x02 bage\x03"));
+
+ r = get_keymaps(&kmaps);
+ if (r == -ENOENT)
+ return; /* skip test if no keymaps are installed */
+
+ assert_se(r >= 0);
+ assert_se(kmaps);
+
+ STRV_FOREACH(p, kmaps) {
+ puts(*p);
+ assert_se(keymap_is_valid(*p));
+ }
+
+ assert_se(keymap_is_valid("uk"));
+ assert_se(keymap_is_valid("de-nodeadkeys"));
+ assert_se(keymap_is_valid("ANSI-dvorak"));
+ assert_se(keymap_is_valid("unicode"));
+}
+
int main(int argc, char *argv[]) {
test_get_locales();
test_locale_is_valid();
+ test_keymaps();
+
return 0;
}