commit: 17b2f2278b39c9259505179d64c8ec38c1c64fb4
parent 27fd2bbbe5ef3c4139ff34422e9f24c96c5c3ba6
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date: Sat, 8 Nov 2025 19:21:54 +0100
test-cmd/chmod.sh: group dash warning into a variable
Diffstat:
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/test-cmd/chmod.sh b/test-cmd/chmod.sh
@@ -10,6 +10,9 @@ target="${WD}/cmd/chmod"
tmpfile="${TMPDIR-/tmp}/test_chmod_$(date +%s)"
ref_file="${TMPDIR-/tmp}/test_chmod_$(date +%s).ref"
+dash_warn='chmod: warning: (portability) Pass -- before a mode with a leading dash(-) to separate it from options
+'
+
touch "$tmpfile" || exit 1
touch "$ref_file" || exit 1
@@ -31,19 +34,16 @@ t '0777' "-v 0777 $tmpfile" "chmod: Permissions changed from 00444/-r--r--r-- to
t --exit=1 'invalid 0888' "-v 0888 $tmpfile" "chmod: error: Failed parsing mode '0888': contains digit outside of [0-7]
"
-t 'mode:-w,+x' "-v -w,+x $tmpfile" "chmod: warning: (portability) Pass -- before a mode with a leading dash(-) to separate it from options
-chmod: Permissions changed from 00777/-rwxrwxrwx to 00577/-r-xrwxrwx for '${tmpfile}'
+t 'mode:-w,+x' "-v -w,+x $tmpfile" "${dash_warn}chmod: Permissions changed from 00777/-rwxrwxrwx to 00577/-r-xrwxrwx for '${tmpfile}'
"
-t 'mode:-r' "-v -r $tmpfile" "chmod: warning: (portability) Pass -- before a mode with a leading dash(-) to separate it from options
-chmod: Permissions changed from 00577/-r-xrwxrwx to 00133/---x-wx-wx for '${tmpfile}'
+t 'mode:-r' "-v -r $tmpfile" "${dash_warn}chmod: Permissions changed from 00577/-r-xrwxrwx to 00133/---x-wx-wx for '${tmpfile}'
"
t 'mode:+t' "-v +t $tmpfile" "chmod: Permissions changed from 00133/---x-wx-wx to 01133/---x-wx-wt for '${tmpfile}'
"
-t 'mode:-t' "-v -t $tmpfile" "chmod: warning: (portability) Pass -- before a mode with a leading dash(-) to separate it from options
-chmod: Permissions changed from 01133/---x-wx-wt to 00133/---x-wx-wx for '${tmpfile}'
+t 'mode:-t' "-v -t $tmpfile" "${dash_warn}chmod: Permissions changed from 01133/---x-wx-wt to 00133/---x-wx-wx for '${tmpfile}'
"
t '__mode:-x,+w' "-v -- -x,+w $tmpfile" "chmod: Permissions changed from 00133/---x-wx-wx to 00222/--w--w--w- for '${tmpfile}'