logo

utils-std

Collection of commonly available Unix tools git clone https://anongit.hacktivis.me/git/utils-std.git
commit: 9028fdf9b20566fe6836fc72b8b28e4405f5f7b1
parent 8a7eb04bf04ebec1f6ccfe04c64a3452e9409d3b
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date:   Sat,  7 Sep 2024 11:39:57 +0200

test-lib/mode.c: Add test for -w,+x

Diffstat:

Mtest-lib/mode.c12+++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/test-lib/mode.c b/test-lib/mode.c @@ -11,7 +11,7 @@ #include <sys/stat.h> // umask int counter = 0; -int err = 0; +int t_err = 0; static void t_mode(const char *str, mode_t old, mode_t expect) @@ -25,7 +25,7 @@ t_mode(const char *str, mode_t old, mode_t expect) return; } - err = 1; + t_err = 1; printf("not ok %d - new_mode(\"%s\", 0%06o) == 0%06o\n", id, str, old, expect); if(got != expect) printf("# Got: 0%06o\n", got); if(errstr != NULL) printf("# Errstr: \"%s\"\n", errstr); @@ -48,7 +48,7 @@ t_mode_errstr(const char *str, mode_t old, const char *expect_errstr) { printf("not ok %d - new_mode(\"%s\", 0%06o) -> %s\n", id, str, old, expect_errstr); printf("# Got errstr: \"%s\"\n", errstr); - err = 1; + t_err = 1; } } @@ -288,7 +288,7 @@ non_symbolic() int main() { - int plan = 154; + int plan = 155; printf("1..%d\n", plan); t_mode(NULL, 0, 0); @@ -298,6 +298,8 @@ main() t_mode(",", 0, 0); t_mode(",", 00777, 00777); + t_mode("-w,+x", 00666, 00577); + add_read(); set_read(); del_read(); @@ -311,5 +313,5 @@ main() non_symbolic(); assert(counter == plan); - return err; + return t_err; }