]> git.ipfire.org Git - thirdparty/systemd.git/blob - src/test/test-qrcode-util.c
c4e2894eb712ffb0fcb91e5294cb2fa3700ec902
[thirdparty/systemd.git] / src / test / test-qrcode-util.c
1 /* SPDX-License-Identifier: LGPL-2.1+ */
2
3 #include "locale-util.h"
4 #include "main-func.h"
5 #include "qrcode-util.h"
6 #include "tests.h"
7
8 static int run(int argc, char **argv) {
9 int r;
10
11 test_setup_logging(LOG_DEBUG);
12
13 assert_se(setenv("SYSTEMD_COLORS", "1", 1) == 0); /* Force the qrcode to be printed */
14
15 r = print_qrcode(stdout, "This should say \"TEST\"", "TEST");
16 if (r == -EOPNOTSUPP)
17 return log_tests_skipped("not supported");
18 if (r < 0)
19 return log_error_errno(r, "Failed to print QR code: %m");
20 return 0;
21 }
22
23 DEFINE_MAIN_FUNCTION(run);