| 1 | (use posix test) |
|---|
| 2 | |
|---|
| 3 | (define (set-file-mask! mask) |
|---|
| 4 | (let ((test-file "foomask")) |
|---|
| 5 | (delete-file* test-file) |
|---|
| 6 | (set! (file-creation-mode) mask) |
|---|
| 7 | (with-output-to-file test-file (cut print "")) |
|---|
| 8 | (number->string (file-permissions test-file) 8))) |
|---|
| 9 | |
|---|
| 10 | (test-begin "umask") |
|---|
| 11 | (test "100660" (set-file-mask! perm/irwxo)) |
|---|
| 12 | (test "100600" (set-file-mask! (bitwise-ior perm/irwxo perm/irwxg))) |
|---|
| 13 | (test "100000" (set-file-mask! (bitwise-ior perm/irwxo perm/irwxg perm/irwxu))) |
|---|
| 14 | |
|---|
| 15 | (test "100664" (set-file-mask! perm/iwoth)) |
|---|
| 16 | (test "100644" (set-file-mask! (bitwise-ior perm/iwoth perm/iwgrp))) |
|---|
| 17 | (test "100444" (set-file-mask! (bitwise-ior perm/iwoth perm/iwgrp perm/iwusr))) |
|---|
| 18 | (test-end "umask") |
|---|