From b750101eb236130cf056c675997decbac904cc49 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 17:35:18 +0200 Subject: Adding upstream version 252.22. Signed-off-by: Daniel Baumann --- src/test/test-umask-util.c | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 src/test/test-umask-util.c (limited to 'src/test/test-umask-util.c') diff --git a/src/test/test-umask-util.c b/src/test/test-umask-util.c new file mode 100644 index 0000000..df3ae98 --- /dev/null +++ b/src/test/test-umask-util.c @@ -0,0 +1,41 @@ +/* SPDX-License-Identifier: LGPL-2.1-or-later */ + +#include "tests.h" +#include "umask-util.h" + +int main(int argc, char *argv[]) { + size_t n; + mode_t u; + + test_setup_logging(LOG_DEBUG); + + u = umask(0111); + + n = 0; + RUN_WITH_UMASK(0123) { + assert_se(umask(000) == 0123); + n++; + } + + assert_se(n == 1); + assert_se(umask(u) == 0111); + + RUN_WITH_UMASK(0135) { + assert_se(umask(000) == 0135); + n++; + } + + assert_se(n == 2); + assert_se(umask(0111) == u); + + RUN_WITH_UMASK(0315) { + assert_se(umask(000) == 0315); + n++; + break; + } + + assert_se(n == 3); + assert_se(umask(u) == 0111); + + return EXIT_SUCCESS; +} -- cgit v1.2.3