summaryrefslogtreecommitdiff
path: root/src/locale
diff options
context:
space:
mode:
authorJan Janssen <medhefgo@web.de>2022-03-14 10:37:27 +0100
committerJan Janssen <medhefgo@web.de>2022-03-16 14:50:12 +0100
commit68da8adf54d7ab88610c161a1c7dd2819eb96886 (patch)
tree0a1f175eb14cb1e984c63f309641cf17df416e66 /src/locale
parent45cab6e3c1d542d66c293a3a722c08412386f335 (diff)
downloadsystemd-68da8adf54d7ab88610c161a1c7dd2819eb96886.tar.gz
test: Use TEST macros in more places
Diffstat (limited to 'src/locale')
-rw-r--r--src/locale/test-keymap-util.c35
1 files changed, 9 insertions, 26 deletions
diff --git a/src/locale/test-keymap-util.c b/src/locale/test-keymap-util.c
index f726e8e524..668f94ec80 100644
--- a/src/locale/test-keymap-util.c
+++ b/src/locale/test-keymap-util.c
@@ -6,11 +6,9 @@
#include "string-util.h"
#include "tests.h"
-static void test_find_language_fallback(void) {
+TEST(find_language_fallback) {
_cleanup_free_ char *ans = NULL, *ans2 = NULL;
- log_info("/*** %s ***/", __func__);
-
assert_se(find_language_fallback("foobar", &ans) == 0);
assert_se(ans == NULL);
@@ -24,12 +22,10 @@ static void test_find_language_fallback(void) {
assert_se(streq(ans2, "szl:pl"));
}
-static void test_find_converted_keymap(void) {
+TEST(find_converted_keymap) {
_cleanup_free_ char *ans = NULL, *ans2 = NULL;
int r;
- log_info("/*** %s ***/", __func__);
-
assert_se(find_converted_keymap("pl", "foobar", &ans) == 0);
assert_se(ans == NULL);
@@ -46,12 +42,10 @@ static void test_find_converted_keymap(void) {
assert_se(streq(ans2, "pl-dvorak"));
}
-static void test_find_legacy_keymap(void) {
+TEST(find_legacy_keymap) {
Context c = {};
_cleanup_free_ char *ans = NULL, *ans2 = NULL;
- log_info("/*** %s ***/", __func__);
-
c.x11_layout = (char*) "foobar";
assert_se(find_legacy_keymap(&c, &ans) == 0);
assert_se(ans == NULL);
@@ -65,11 +59,9 @@ static void test_find_legacy_keymap(void) {
assert_se(streq(ans, "pl2"));
}
-static void test_vconsole_convert_to_x11(void) {
+TEST(vconsole_convert_to_x11) {
_cleanup_(context_clear) Context c = {};
- log_info("/*** %s ***/", __func__);
-
log_info("/* test emptying first (:) */");
assert_se(free_and_strdup(&c.x11_layout, "foo") >= 0);
assert_se(free_and_strdup(&c.x11_variant, "bar") >= 0);
@@ -119,12 +111,10 @@ static void test_vconsole_convert_to_x11(void) {
assert_se(c.x11_variant == NULL);
}
-static void test_x11_convert_to_vconsole(void) {
+TEST(x11_convert_to_vconsole) {
_cleanup_(context_clear) Context c = {};
int r;
- log_info("/*** %s ***/", __func__);
-
log_info("/* test emptying first (:) */");
assert_se(free_and_strdup(&c.vc_keymap, "foobar") >= 0);
assert_se(x11_convert_to_vconsole(&c) == 1);
@@ -189,20 +179,13 @@ static void test_x11_convert_to_vconsole(void) {
assert_se(streq(c.vc_keymap, "ru"));
}
-int main(int argc, char **argv) {
+static int intro(void) {
_cleanup_free_ char *map = NULL;
- test_setup_logging(LOG_DEBUG);
-
- test_find_language_fallback();
- test_find_converted_keymap();
-
assert_se(get_testdata_dir("test-keymap-util/kbd-model-map", &map) >= 0);
assert_se(setenv("SYSTEMD_KBD_MODEL_MAP", map, 1) == 0);
- test_find_legacy_keymap();
- test_vconsole_convert_to_x11();
- test_x11_convert_to_vconsole();
-
- return 0;
+ return EXIT_SUCCESS;
}
+
+DEFINE_TEST_MAIN_WITH_INTRO(LOG_DEBUG, intro);