From 1c21e1313b9c60cb14e98a4e91de40ffd6b6a660 Mon Sep 17 00:00:00 2001 From: Benjamin Lupton Date: Wed, 8 Jan 2025 18:06:05 +0800 Subject: [PATCH] fs-own, tests: mode debugging of tests --- commands/fs-own | 20 ++++++++++---------- sources/tests.bash | 4 +++- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/commands/fs-own b/commands/fs-own index c5d9dffa7..fc6c24b98 100755 --- a/commands/fs-own +++ b/commands/fs-own @@ -10,37 +10,37 @@ function fs_own_test() ( file="$(fs-temp --root="$root" --file='file' --touch)" fs-structure -- "$root" - + eval-tester --name='can own a file +quiet' \ -- fs-own --quiet -- "$file" fs-structure -- "$root" - + eval-tester --name='can own a directory +quiet' \ -- fs-own --quiet -- "$dir" fs-structure -- "$root" - + eval-tester --name='can own a file -quiet' --ignore-stdout \ -- fs-own --no-quiet -- "$file" fs-structure -- "$root" - + eval-tester --name='can own a directory -quiet' --ignore-stdout \ -- fs-own --no-quiet -- "$dir" fs-structure -- "$root" - + eval-tester --name='can own a file +verbose' --ignore-stdout --ignore-stderr \ -- fs-own --verbose -- "$file" fs-structure -- "$root" - + eval-tester --name='can own a directory +verbose' --ignore-stdout --ignore-stderr \ -- fs-own --verbose -- "$dir" fs-structure -- "$root" - + eval-tester --name='can own a directory +quiet +admin' --ignore-stderr \ -- fs-own --quiet --admin -- "$dir" @@ -51,7 +51,7 @@ function fs_own_test() ( fs-structure -- "$root" - eval-tester --name='can own a directory +quiet +root' --ignore-stderr \ + eval-tester --name='can own a directory +quiet +root' --ignore-stdout --ignore-stderr \ -- fs-own --verbose --root -- "$dir" fs-structure -- "$root" @@ -112,7 +112,7 @@ function fs_own() ( if provided, only the exact path will be used, not any child paths. QUIRKS: - If [--permissions=...], [--directory-permissions=...], [--file-permissions=...] are all omitted, then the directory permissions will be set to [755] and the file permissions set to [644]. + If [--permissions=...], [--directory-permissions=...], [--file-permissions=...] are all omitted, then the permissions will be set to [a-xrw,ug+Xrw]. EOF if [[ $# -ne 0 ]]; then echo-error "$@" @@ -299,7 +299,7 @@ function fs_own() ( fi if [[ $option_verbose == 'yes' ]]; then if is-mac; then - echo-style --dim='Verbose permission changes is not provided by this Operating System.' >/dev/stderr + ch_args+=('-v') else ch_args+=('--verbose') fi diff --git a/sources/tests.bash b/sources/tests.bash index 36eb376a0..da43c86be 100644 --- a/sources/tests.bash +++ b/sources/tests.bash @@ -117,7 +117,7 @@ function fs_tests__prep { "$root/targets/unwritable-empty-file" \ "$root/targets/unwritable-filled-dir" \ "$root/targets/unwritable-filled-file" - sudo-helper -- chown '0:0' \ + sudo-helper -- chown -n '0:0' \ "$root/targets/unaccessible-empty-dir" \ "$root/targets/unaccessible-empty-file" \ "$root/targets/unaccessible-filled-dir" \ @@ -128,6 +128,8 @@ function fs_tests__prep { "$root/targets/unaccessible-filled-dir" \ "$root/targets/unaccessible-filled-file" + fs-structure -- "$root" + __print_lines "$root" }