summaryrefslogtreecommitdiff
path: root/src/xdg-autostart-generator
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/xdg-autostart-generator
parent45cab6e3c1d542d66c293a3a722c08412386f335 (diff)
downloadsystemd-68da8adf54d7ab88610c161a1c7dd2819eb96886.tar.gz
test: Use TEST macros in more places
Diffstat (limited to 'src/xdg-autostart-generator')
-rw-r--r--src/xdg-autostart-generator/test-xdg-autostart.c19
1 files changed, 7 insertions, 12 deletions
diff --git a/src/xdg-autostart-generator/test-xdg-autostart.c b/src/xdg-autostart-generator/test-xdg-autostart.c
index c7a816bc25..841a5606f6 100644
--- a/src/xdg-autostart-generator/test-xdg-autostart.c
+++ b/src/xdg-autostart-generator/test-xdg-autostart.c
@@ -9,7 +9,7 @@
#include "tmpfile-util.h"
#include "xdg-autostart-service.h"
-static void test_translate_name(void) {
+TEST(translate_name) {
_cleanup_free_ char *t;
assert_se(t = xdg_autostart_service_translate_name("a-b.blub.desktop"));
@@ -24,7 +24,7 @@ static void test_xdg_format_exec_start_one(const char *exec, const char *expecte
assert_se(streq(out, expected));
}
-static void test_xdg_format_exec_start(void) {
+TEST(xdg_format_exec_start) {
test_xdg_format_exec_start_one("/bin/sleep 100", "/bin/sleep \"100\"");
/* All standardised % identifiers are stripped. */
@@ -50,7 +50,7 @@ static const char* const xdg_desktop_file[] = {
"Hidden=\t true\n"),
};
-static void test_xdg_desktop_parse(unsigned i, const char *s) {
+static void test_xdg_desktop_parse_one(unsigned i, const char *s) {
_cleanup_(unlink_tempfilep) char name[] = "/tmp/test-xdg-autostart-parser.XXXXXX";
_cleanup_fclose_ FILE *f = NULL;
_cleanup_(xdg_autostart_service_freep) XdgAutostartService *service = NULL;
@@ -80,14 +80,9 @@ static void test_xdg_desktop_parse(unsigned i, const char *s) {
}
}
-int main(int argc, char *argv[]) {
- test_setup_logging(LOG_DEBUG);
-
- test_translate_name();
- test_xdg_format_exec_start();
-
+TEST(xdg_desktop_parse) {
for (size_t i = 0; i < ELEMENTSOF(xdg_desktop_file); i++)
- test_xdg_desktop_parse(i, xdg_desktop_file[i]);
-
- return 0;
+ test_xdg_desktop_parse_one(i, xdg_desktop_file[i]);
}
+
+DEFINE_TEST_MAIN(LOG_DEBUG);